# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
# ChangeSet 1.1003.9.25+1.930.107.17 -> 1.1003.9.26
# include/acpi/acglobal.h 1.22 -> 1.23
# drivers/acpi/namespace/nsxfobj.c 1.15 -> 1.16
# drivers/acpi/pci_link.c 1.1 -> (deleted)
# include/asm-i386/mpspec.h 1.9 -> 1.10
# drivers/scsi/megaraid.c 1.19.1.5 -> 1.23.1.1
# include/acpi/acpixf.h 1.20 -> 1.21
# drivers/acpi/resources/rsio.c 1.11 -> 1.12
# include/linux/acpi.h 1.17 -> 1.18
# drivers/acpi/resources/rsaddr.c 1.12 -> 1.13
# drivers/acpi/power.c 1.1 -> (deleted)
# drivers/acpi/executer/exoparg3.c 1.8 -> 1.9
# drivers/acpi/fan.c 1.1 -> (deleted)
# include/linux/sysctl.h 1.23.1.3 -> 1.26
# drivers/acpi/hardware/hwacpi.c 1.15 -> 1.16
# drivers/acpi/debugger/dbstats.c 1.3.1.1 -> (deleted)
# drivers/acpi/events/Makefile 1.2.1.1 -> 1.4
# include/acpi/acutils.h 1.22 -> 1.23
# include/acpi/acpiosxf.h 1.24 -> 1.25
# drivers/acpi/debugger/dbcmds.c 1.3.1.1 -> (deleted)
# drivers/acpi/pci_root.c 1.2 -> (deleted)
# drivers/acpi/dispatcher/dsobject.c 1.21 -> 1.22
# drivers/acpi/hardware/hwgpe.c 1.17 -> 1.18
# include/linux/mm.h 1.39.1.3 -> 1.46
# include/acpi/achware.h 1.15 -> 1.16
# drivers/acpi/executer/exconvrt.c 1.17 -> 1.18
# drivers/acpi/executer/exfield.c 1.15 -> 1.16
# drivers/acpi/parser/psscope.c 1.11 -> 1.12
# include/asm-i386/fixmap.h 1.4.1.2 -> 1.7
# drivers/acpi/ac.c 1.1 -> (deleted)
# include/acpi/aclocal.h 1.26 -> 1.27
# drivers/acpi/tables/Makefile 1.2.1.1 -> 1.4
# include/acpi/acexcep.h 1.13 -> 1.14
# drivers/acpi/utilities/uteval.c 1.15 -> 1.16
# drivers/acpi/resources/rsutils.c 1.13 -> 1.14
# drivers/acpi/dispatcher/dswload.c 1.18 -> 1.19
# drivers/acpi/utilities/utmisc.c 1.24 -> 1.25
# drivers/acpi/hardware/hwsleep.c 1.22 -> 1.23
# drivers/acpi/events/evrgnini.c 1.16 -> 1.17
# drivers/acpi/executer/exdump.c 1.15 -> 1.16
# include/acpi/acstruct.h 1.12 -> 1.13
# kernel/sysctl.c 1.19.1.2 -> 1.21
# Makefile 1.190.1.32 -> 1.193.1.20
# drivers/acpi/events/evregion.c 1.17 -> 1.18
# drivers/acpi/dispatcher/dsfield.c 1.18 -> 1.19
# drivers/acpi/utilities/utglobal.c 1.20 -> 1.21
# include/acpi/acnamesp.h 1.17 -> 1.18
# drivers/acpi/executer/exstoren.c 1.14 -> 1.15
# include/asm-ia64/mmu_context.h 1.4.1.1 -> 1.5.2.1
# include/acpi/acobject.h 1.16 -> 1.17
# drivers/acpi/hardware/hwtimer.c 1.14 -> 1.15
# include/acpi/acresrc.h 1.12 -> 1.13
# drivers/acpi/utilities/utalloc.c 1.14 -> 1.15
# drivers/acpi/utilities/utxface.c 1.15 -> 1.16
# arch/ia64/kernel/setup.c 1.11.1.1 -> 1.11.2.1
# drivers/acpi/resources/Makefile 1.2.1.1 -> 1.4
# drivers/acpi/executer/exregion.c 1.14 -> 1.15
# drivers/acpi/resources/rsxface.c 1.15 -> 1.16
# include/acpi/actbl1.h 1.11 -> 1.12
# drivers/acpi/system.c 1.2 -> (deleted)
# drivers/acpi/namespace/Makefile 1.2.1.1 -> 1.4
# drivers/acpi/parser/psopcode.c 1.15 -> 1.16
# include/acpi/acdebug.h 1.16 -> 1.17
# drivers/acpi/events/evxfregn.c 1.15 -> 1.16
# drivers/acpi/executer/Makefile 1.2.1.1 -> 1.4
# drivers/acpi/parser/psparse.c 1.17 -> 1.18
# drivers/acpi/debugger/dbutils.c 1.3.1.1 -> (deleted)
# include/asm-arm/page.h 1.4.1.1 -> 1.6
# init/main.c 1.26.1.1 -> 1.28
# arch/i386/kernel/Makefile 1.6 -> 1.7
# drivers/acpi/parser/pswalk.c 1.12 -> 1.13
# drivers/ide/ide-dma.c 1.6.1.6 -> 1.10.1.2
# drivers/acpi/executer/exprep.c 1.14 -> 1.15
# drivers/acpi/executer/exutils.c 1.17 -> 1.18
# drivers/acpi/executer/exoparg6.c 1.7 -> 1.8
# drivers/acpi/debugger/dbdisply.c 1.3.1.1 -> (deleted)
# include/acpi/acconfig.h 1.35 -> 1.36
# drivers/acpi/dispatcher/Makefile 1.2.1.1 -> 1.4
# include/acpi/platform/acenv.h 1.12 -> 1.13
# drivers/acpi/namespace/nsxfname.c 1.14 -> 1.15
# drivers/acpi/tables/tbinstal.c 1.16 -> 1.17
# drivers/acpi/executer/exresnte.c 1.16 -> 1.17
# drivers/acpi/tables/tbutils.c 1.15 -> 1.16
# drivers/acpi/ec.c 1.1 -> (deleted)
# include/linux/fs.h 1.69.1.6 -> 1.73
# drivers/scsi/Makefile 1.19 -> 1.20
# drivers/acpi/resources/rsmisc.c 1.11 -> 1.12
# drivers/acpi/resources/rsmemory.c 1.12 -> 1.13
# arch/i386/kernel/acpi.c 1.2 -> (deleted)
# drivers/acpi/battery.c 1.1 -> (deleted)
# drivers/acpi/debugger/dbexec.c 1.2.1.1 -> (deleted)
# drivers/acpi/dispatcher/dsopcode.c 1.17 -> 1.18
# include/acpi/actables.h 1.13 -> 1.14
# drivers/acpi/osl.c 1.2 -> (deleted)
# drivers/net/Makefile 1.29.1.6 -> 1.33.1.1
# drivers/acpi/events/evxfevnt.c 1.17 -> 1.18
# drivers/acpi/parser/pstree.c 1.12 -> 1.13
# drivers/acpi/parser/psargs.c 1.16 -> 1.17
# drivers/hotplug/acpiphp_glue.c 1.5 -> 1.6
# drivers/acpi/executer/exnames.c 1.12 -> 1.13
# arch/i386/kernel/mpparse.c 1.27 -> 1.28
# drivers/acpi/executer/exfldio.c 1.19 -> 1.20
# arch/i386/config.in 1.43 -> 1.44
# arch/i386/kernel/io_apic.c 1.27 -> 1.28
# drivers/acpi/acpi_ksyms.c 1.21 -> 1.22
# drivers/acpi/utilities/Makefile 1.2.1.1 -> 1.4
# drivers/acpi/resources/rscreate.c 1.14 -> 1.15
# include/asm-ia64/processor.h 1.16.2.2 -> 1.16.2.3
# include/acpi/acoutput.h 1.14 -> 1.15
# drivers/acpi/namespace/nsinit.c 1.18 -> 1.19
# drivers/acpi/dispatcher/dsmthdat.c 1.18 -> 1.19
# drivers/acpi/namespace/nsobject.c 1.14 -> 1.15
# drivers/acpi/executer/exresolv.c 1.15 -> 1.16
# drivers/acpi/executer/excreate.c 1.14 -> 1.15
# drivers/acpi/tables/tbconvrt.c 1.21 -> 1.22
# drivers/acpi/namespace/nseval.c 1.15 -> 1.16
# arch/i386/kernel/pci-pc.c 1.24.1.4 -> 1.31
# include/linux/pci_ids.h 1.44.1.21 -> 1.46.1.14
# include/asm-i386/pci.h 1.14.1.2 -> 1.17
# drivers/net/tg3.c 1.61.2.4 -> 1.62.1.4
# drivers/acpi/utilities/utcopy.c 1.20 -> 1.21
# arch/ia64/mm/init.c 1.7.2.1 -> 1.7.3.1
# drivers/scsi/Config.in 1.15.1.4 -> 1.18.1.1
# drivers/acpi/executer/exstore.c 1.21 -> 1.22
# include/acpi/actbl71.h 1.10 -> 1.11
# drivers/acpi/resources/rsirq.c 1.12 -> 1.13
# drivers/acpi/dispatcher/dsutils.c 1.15 -> 1.16
# arch/i386/kernel/setup.c 1.68 -> 1.69
# kernel/printk.c 1.9.1.2 -> 1.13
# drivers/acpi/utilities/utdelete.c 1.16 -> 1.17
# drivers/acpi/dispatcher/dsmethod.c 1.14 -> 1.15
# arch/ia64/kernel/acpi.c 1.6.3.8 -> 1.6.4.1
# drivers/acpi/debugger/dbdisasm.c 1.3.1.1 -> (deleted)
# drivers/acpi/namespace/nsutils.c 1.21 -> 1.22
# include/acpi/actbl.h 1.13 -> 1.14
# include/acpi/acpi.h 1.8 -> 1.9
# drivers/acpi/utils.c 1.1 -> (deleted)
# arch/ia64/config.in 1.13.4.1 -> 1.13.4.2
# drivers/acpi/executer/exoparg2.c 1.17 -> 1.18
# drivers/acpi/namespace/nsalloc.c 1.15 -> 1.16
# drivers/acpi/resources/rscalc.c 1.15 -> 1.16
# arch/i386/kernel/acpi_wakeup.S 1.1 -> (deleted)
# include/acpi/acmacros.h 1.17 -> 1.18
# drivers/acpi/parser/Makefile 1.2.1.1 -> 1.4
# drivers/acpi/resources/rsdump.c 1.13 -> 1.14
# arch/ia64/kernel/sys_ia64.c 1.8.1.2 -> 1.9.2.1
# fs/Makefile 1.16.1.1 -> 1.18
# drivers/acpi/events/evxface.c 1.17 -> 1.18
# drivers/acpi/utilities/utinit.c 1.15 -> 1.16
# drivers/acpi/parser/psutils.c 1.11 -> 1.12
# include/acpi/actypes.h 1.27 -> 1.28
# include/acpi/acevents.h 1.16 -> 1.17
# drivers/acpi/events/evmisc.c 1.20 -> 1.21
# drivers/acpi/executer/exconfig.c 1.13 -> 1.14
# kernel/exec_domain.c 1.8.1.1 -> 1.10
# arch/ia64/hp/common/sba_iommu.c 1.1.2.11 -> 1.1.3.1
# include/acpi/actbl2.h 1.14 -> 1.15
# drivers/acpi/utilities/utdebug.c 1.16 -> 1.17
# drivers/acpi/debugger/dbhistry.c 1.2.1.1 -> (deleted)
# drivers/acpi/tables/tbget.c 1.16 -> 1.17
# drivers/net/eepro100.c 1.36.2.16 -> 1.37.1.7
# include/acpi/acparser.h 1.13 -> 1.14
# drivers/acpi/utilities/utobject.c 1.16 -> 1.17
# include/acpi/amlcode.h 1.14 -> 1.15
# fs/Config.in 1.20.1.1 -> 1.23
# include/asm-i386/io_apic.h 1.10 -> 1.11
# drivers/acpi/events/evsci.c 1.14 -> 1.15
# drivers/acpi/executer/exsystem.c 1.12 -> 1.13
# drivers/acpi/debugger/dbfileio.c 1.3.1.1 -> (deleted)
# drivers/acpi/bus.c 1.2 -> (deleted)
# include/acpi/acdispat.h 1.11 -> 1.12
# drivers/acpi/debugger/dbxface.c 1.3.1.1 -> (deleted)
# drivers/acpi/tables/tbxfroot.c 1.14 -> 1.15
# drivers/acpi/processor.c 1.1 -> (deleted)
# include/acpi/platform/aclinux.h 1.17 -> 1.18
# drivers/acpi/debugger/Makefile 1.1.1.1 -> (deleted)
# drivers/acpi/executer/exmutex.c 1.10 -> 1.11
# drivers/acpi/parser/psxface.c 1.14 -> 1.15
# include/asm-i386/acpi.h 1.1 -> (deleted)
# include/asm-i386/save_state.h 1.1 -> (deleted)
# drivers/acpi/events/evevent.c 1.23 -> 1.24
# drivers/acpi/executer/exmisc.c 1.17 -> 1.18
# drivers/acpi/hardware/hwregs.c 1.20 -> 1.21
# drivers/acpi/Config.in 1.9 -> 1.10
# drivers/acpi/dispatcher/dswstate.c 1.16 -> 1.17
# drivers/acpi/executer/exresop.c 1.16 -> 1.17
# include/acpi/acinterp.h 1.19 -> 1.20
# drivers/acpi/tables/tbxface.c 1.14 -> 1.15
# drivers/acpi/executer/exoparg1.c 1.17 -> 1.18
# drivers/acpi/namespace/nsdump.c 1.16 -> 1.17
# drivers/acpi/namespace/nsload.c 1.16 -> 1.17
# Documentation/Configure.help 1.162 -> 1.163
# drivers/acpi/hardware/Makefile 1.2.1.1 -> 1.4
# drivers/acpi/Makefile 1.16 -> 1.17
# drivers/acpi/executer/exstorob.c 1.16 -> 1.17
# drivers/acpi/utilities/utmath.c 1.7 -> 1.8
# drivers/acpi/button.c 1.1 -> (deleted)
# drivers/acpi/debugger/dbinput.c 1.3.1.1 -> (deleted)
# drivers/acpi/namespace/nssearch.c 1.16 -> 1.17
# drivers/acpi/namespace/nsaccess.c 1.18 -> 1.19
# drivers/scsi/scsi_ioctl.c 1.7.1.1 -> 1.10
# drivers/acpi/dispatcher/dswexec.c 1.18 -> 1.19
# include/acpi/platform/acgcc.h 1.16 -> 1.17
# fs/inode.c 1.36.1.1 -> 1.38
# drivers/acpi/dispatcher/dswscope.c 1.13 -> 1.14
# drivers/acpi/thermal.c 1.1 -> (deleted)
# arch/i386/kernel/pci-irq.c 1.20 -> 1.21
# drivers/acpi/namespace/nswalk.c 1.12 -> 1.13
# drivers/acpi/tables.c 1.1 -> (deleted)
# drivers/acpi/resources/rslist.c 1.11 -> 1.12
# drivers/acpi/pci_bind.c 1.1 -> (deleted)
# drivers/acpi/pci_irq.c 1.1 -> (deleted)
# drivers/acpi/namespace/nsnames.c 1.16 -> 1.17
#
diff -Nru a/Documentation/Configure.help b/Documentation/Configure.help
--- a/Documentation/Configure.help Wed Oct 8 09:05:46 2003
+++ b/Documentation/Configure.help Wed Oct 8 09:05:46 2003
@@ -18729,54 +18729,6 @@
The ACPI Sourceforge project may also be of interest:
-ACPI Processor Enumeration Only
-CONFIG_ACPI_HT_ONLY
- This option enables limited ACPI support -- just enough to
- enumerate processors from the ACPI Multiple APIC Description
- Table (MADT). Note that ACPI supports both logical (e.g. Hyper-
- Threading) and physical processors, where the MultiProcessor
- Specification (MPS) table only supports physical processors.
-
- Full ACPI support (CONFIG_ACPI) is preferred. Use this option
- only if you wish to limit ACPI's role to processor enumeration.
-
- In this configuration, ACPI defaults to off. It must be enabled
- on the command-line with the "acpismp=force" option.
-
-Enable ACPI 2.0 with errata 1.3
-CONFIG_ACPI20
- Enable support for the 2.0 version of the ACPI interpreter. See the
- help for ACPI for caveats and discussion.
-
-ACPI kernel configuration manager
-CONFIG_ACPI_KERNEL_CONFIG
- If you say `Y' here, Linux's ACPI support will use the
- hardware-level system descriptions found on IA64 machines.
-
-ACPI Debug Statements
-CONFIG_ACPI_DEBUG
- The ACPI driver can optionally report errors with a great deal
- of verbosity. Saying Y enables these statements. This will increase
- your kernel size by around 50K.
-
-ACPI Bus Manager
-CONFIG_ACPI_BUSMGR
- The ACPI Bus Manager enumerates devices in the ACPI namespace, and
- handles PnP messages. All ACPI devices use its services, so using
- them requires saying Y here.
-
-ACPI System Driver
-CONFIG_ACPI_SYS
- This driver will enable your system to shut down using ACPI, and
- dump your ACPI DSDT table using /proc/acpi/dsdt.
-
-ACPI Processor Driver
-CONFIG_ACPI_CPU
- This driver installs ACPI as the idle handler for Linux, and uses
- ACPI C2 and C3 processor states to save power, on systems that
- support it.
-
-ACPI Button
CONFIG_ACPI_BUTTON
This driver registers for events based on buttons, such as the
power, sleep, and lid switch. In the future, a daemon will read
@@ -18784,20 +18736,6 @@
down the system. Until then, you can cat it, and see output when
a button is pressed.
-CONFIG_ACPI_BATTERY
- This driver adds support for battery information through
- /proc/acpi/battery. If you have a mobile system with a battery,
- say Y.
-
-CONFIG_ACPI_FAN
- This driver adds support for ACPI fan devices, allowing user-mode
- applications to perform basic fan control (on, off, status).
-
-CONFIG_ACPI_PROCESSOR
- This driver installs ACPI as the idle handler for Linux, and uses
- ACPI C2 and C3 processor states to save power, on systems that
- support it.
-
ACPI AC Adapter
CONFIG_ACPI_AC
This driver adds support for the AC Adapter object, which indicates
@@ -18807,65 +18745,18 @@
ACPI Embedded Controller
CONFIG_ACPI_EC
This driver is required on some systems for the proper operation of
- the battery and thermal drivers. If you are compiling for a laptop,
- say Y.
+ the battery and thermal drivers. If you are compiling for a
+ mobile system, say Y.
-ACPI Control Method Battery
-CONFIG_ACPI_CMBATT
- This driver adds support for battery information through
- /proc/acpi/battery. If you have a laptop with a battery, say Y.
+CONFIG_ACPI_PROCESSOR
+ This driver installs ACPI as the idle handler for Linux, and uses
+ ACPI C2 and C3 processor states to save power, on systems that
+ support it.
-ACPI Thermal
CONFIG_ACPI_THERMAL
This driver handles overheating conditions on laptops. It is HIGHLY
recommended, as your laptop CPU may be damaged without it.
-ACPI ASUS/Medion Laptop Extras
-CONFIG_ACPI_ASUS
- This driver provides support for extra features of ACPI-compatible
- ASUS laptops. As some of Medion laptops are made by ASUS, it may also
- support some Medion laptops (such as 9675 for example). It makes all
- the extra buttons generate standard ACPI events that go through
- /proc/acpi/events, and (on some models) adds support for changing the
- display brightness and output, switching the LCD backlight on and off,
- and most importantly, allows you to blink those fancy LEDs intended
- for reporting mail and wireless status.
-
- All settings are changed via /proc/acpi/asus directory entries. Owner
- and group for these entries can be set with asus_uid and asus_gid
- parameters.
-
- More information and a userspace daemon for handling the extra buttons
- at .
-
- If you have an ACPI-compatible ASUS laptop, say Y or M here. This
- driver is still under development, so if your laptop is unsupported or
- something works not quite as expected, please use the mailing list
- available on the above page (acpi4asus-user@lists.sourceforge.net)
-
-ACPI Toshiba Laptop Extras
-CONFIG_ACPI_TOSHIBA
- This driver adds support for access to certain system settings
- on "legacy free" Toshiba laptops. These laptops can be recognized by
- their lack of a BIOS setup menu and APM support.
-
- On these machines, all system configuration is handled through the
- ACPI. This driver is required for access to controls not covered
- by the general ACPI drivers, such as LCD brightness, video output,
- etc.
-
- This driver differs from the non-ACPI Toshiba laptop driver (located
- under "Processor type and features") in several aspects.
- Configuration is accessed by reading and writing text files in the
- /proc tree instead of by program interface to /dev. Furthermore, no
- power management functions are exposed, as those are handled by the
- general ACPI drivers.
-
- More information about this driver is available at
- .
-
- If you have a legacy free Toshiba laptop (such as the Libretto L1
- series), say Y.
Advanced Power Management BIOS support
CONFIG_APM
@@ -25977,11 +25868,13 @@
# Choice: ia64type
Itanium
CONFIG_ITANIUM
- Select your IA64 processor type. The default is Intel Itanium.
+ Select your IA-64 processor type. The default is Intel Itanium.
+ This choice is safe for all IA-64 systems, but may not perform
+ optimally on systems with, say, Itanium 2 or newer processors.
-McKinley
+Itanium 2
CONFIG_MCKINLEY
- Select this to configure for a McKinley processor.
+ Select this to configure for an Itanium 2 (McKinley) processor.
# Choice: ia64system
IA-64 system type
@@ -26058,12 +25951,31 @@
and restore instructions. It's useful for tracking down spinlock
problems, but slow! If you're unsure, select N.
-Early printk support (requires VGA!)
+Early printk support
CONFIG_IA64_EARLY_PRINTK
- Selecting this option uses the VGA screen for printk() output before
- the consoles are initialised. It is useful for debugging problems
- early in the boot process, but only if you have a VGA screen
- attached. If you're unsure, select N.
+ Selecting this option uses a UART or VGA screen (or both) for
+ printk() output before the consoles are initialised. It is useful
+ for debugging problems early in the boot process, but only if you
+ have a serial terminal or a VGA screen attached. If you're unsure,
+ select N.
+
+Early printk on serial port
+CONFIG_IA64_EARLY_PRINTK_UART
+ Select this option to use a serial port for early printk() output.
+ You must also select either CONFIG_IA64_EARLY_PRINTK_UART_BASE or
+ CONFIG_SERIAL_HCDP. If you select CONFIG_SERIAL_HCDP, early
+ printk() output will appear on the first console device described by
+ the HCDP. If you set CONFIG_IA64_EARLY_PRINTK_UART_BASE, the HCDP
+ will be ignored.
+
+UART base address
+CONFIG_IA64_EARLY_PRINTK_UART_BASE
+ The physical MMIO address of the UART to use for early printk().
+ This overrides any UART located using the EFI HCDP table.
+
+Early printk on VGA
+CONFIG_IA64_EARLY_PRINTK_VGA
+ Select this option to use VGA for early printk() output.
Print possible IA64 hazards to console
CONFIG_IA64_PRINT_HAZARDS
diff -Nru a/Makefile b/Makefile
--- a/Makefile Wed Oct 8 09:05:45 2003
+++ b/Makefile Wed Oct 8 09:05:45 2003
@@ -93,6 +93,7 @@
CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -Wno-trigraphs -O2 \
-fno-strict-aliasing -fno-common
+CFLAGS += -g
ifndef CONFIG_FRAME_POINTER
CFLAGS += -fomit-frame-pointer
endif
@@ -304,8 +305,7 @@
$(CONFIG_SHELL) scripts/Configure -d arch/$(ARCH)/config.in
xconfig: symlinks
- $(MAKE) -C scripts kconfig.tk
- wish -f scripts/kconfig.tk
+ @echo -e "***\n* Sorry, xconfig is broken; use \"make menuconfig\" instead.\n***"
menuconfig: include/linux/version.h symlinks
$(MAKE) -C scripts/lxdialog all
diff -Nru a/arch/i386/kernel/acpi.c b/arch/i386/kernel/acpi.c
--- a/arch/i386/kernel/acpi.c Wed Oct 8 09:05:45 2003
+++ /dev/null Wed Dec 31 16:00:00 1969
@@ -1,557 +0,0 @@
-/*
- * acpi.c - Architecture-Specific Low-Level ACPI Support
- *
- * Copyright (C) 2001, 2002 Paul Diefenbaugh
- * Copyright (C) 2001 Jun Nakajima
- * Copyright (C) 2001 Patrick Mochel
- *
- * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- */
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-
-#define PREFIX "ACPI: "
-
-
-/* --------------------------------------------------------------------------
- Boot-time Configuration
- -------------------------------------------------------------------------- */
-
-#ifdef CONFIG_ACPI_BOOT
-
-enum acpi_irq_model_id acpi_irq_model;
-
-
-/*
- * Use reserved fixmap pages for physical-to-virtual mappings of ACPI tables.
- * Note that the same range is used for each table, so tables that need to
- * persist should be memcpy'd.
- */
-char *
-__acpi_map_table (
- unsigned long phys_addr,
- unsigned long size)
-{
- unsigned long base = 0;
- unsigned long mapped_phys = phys_addr;
- unsigned long offset = phys_addr & (PAGE_SIZE - 1);
- unsigned long mapped_size = PAGE_SIZE - offset;
- unsigned long avail_size = mapped_size + (PAGE_SIZE * FIX_ACPI_PAGES);
- int idx = FIX_ACPI_BEGIN;
-
- if (!phys_addr || !size)
- return NULL;
-
- base = fix_to_virt(FIX_ACPI_BEGIN);
-
- set_fixmap(idx, mapped_phys);
-
- if (size > avail_size)
- return NULL;
-
- /* If the table doesn't map completely into the fist page... */
- if (size > mapped_size) {
- do {
- /* Make sure we don't go past our range */
- if (idx++ == FIX_ACPI_END)
- return NULL;
- mapped_phys = mapped_phys + PAGE_SIZE;
- set_fixmap(idx, mapped_phys);
- mapped_size = mapped_size + PAGE_SIZE;
- } while (mapped_size < size);
- }
-
- return ((unsigned char *) base + offset);
-}
-
-
-#ifdef CONFIG_X86_LOCAL_APIC
-
-int acpi_lapic;
-
-static u64 acpi_lapic_addr __initdata = APIC_DEFAULT_PHYS_BASE;
-
-
-static int __init
-acpi_parse_madt (
- unsigned long phys_addr,
- unsigned long size)
-{
- struct acpi_table_madt *madt = NULL;
-
- if (!phys_addr || !size)
- return -EINVAL;
-
- madt = (struct acpi_table_madt *) __acpi_map_table(phys_addr, size);
- if (!madt) {
- printk(KERN_WARNING PREFIX "Unable to map MADT\n");
- return -ENODEV;
- }
-
- if (madt->lapic_address)
- acpi_lapic_addr = (u64) madt->lapic_address;
-
- printk(KERN_INFO PREFIX "Local APIC address 0x%08x\n",
- madt->lapic_address);
-
- return 0;
-}
-
-
-static int __init
-acpi_parse_lapic (
- acpi_table_entry_header *header)
-{
- struct acpi_table_lapic *processor = NULL;
-
- processor = (struct acpi_table_lapic*) header;
- if (!processor)
- return -EINVAL;
-
- acpi_table_print_madt_entry(header);
-
- mp_register_lapic (
- processor->id, /* APIC ID */
- processor->flags.enabled); /* Enabled? */
-
- return 0;
-}
-
-
-static int __init
-acpi_parse_lapic_addr_ovr (
- acpi_table_entry_header *header)
-{
- struct acpi_table_lapic_addr_ovr *lapic_addr_ovr = NULL;
-
- lapic_addr_ovr = (struct acpi_table_lapic_addr_ovr*) header;
- if (!lapic_addr_ovr)
- return -EINVAL;
-
- acpi_lapic_addr = lapic_addr_ovr->address;
-
- return 0;
-}
-
-
-static int __init
-acpi_parse_lapic_nmi (
- acpi_table_entry_header *header)
-{
- struct acpi_table_lapic_nmi *lapic_nmi = NULL;
-
- lapic_nmi = (struct acpi_table_lapic_nmi*) header;
- if (!lapic_nmi)
- return -EINVAL;
-
- acpi_table_print_madt_entry(header);
-
- if (lapic_nmi->lint != 1)
- printk(KERN_WARNING PREFIX "NMI not connected to LINT 1!\n");
-
- return 0;
-}
-
-#endif /*CONFIG_X86_LOCAL_APIC*/
-
-#ifdef CONFIG_X86_IO_APIC
-
-int acpi_ioapic;
-
-static int __init
-acpi_parse_ioapic (
- acpi_table_entry_header *header)
-{
- struct acpi_table_ioapic *ioapic = NULL;
-
- ioapic = (struct acpi_table_ioapic*) header;
- if (!ioapic)
- return -EINVAL;
-
- acpi_table_print_madt_entry(header);
-
- mp_register_ioapic (
- ioapic->id,
- ioapic->address,
- ioapic->global_irq_base);
-
- return 0;
-}
-
-
-static int __init
-acpi_parse_int_src_ovr (
- acpi_table_entry_header *header)
-{
- struct acpi_table_int_src_ovr *intsrc = NULL;
-
- intsrc = (struct acpi_table_int_src_ovr*) header;
- if (!intsrc)
- return -EINVAL;
-
- acpi_table_print_madt_entry(header);
-
- mp_override_legacy_irq (
- intsrc->bus_irq,
- intsrc->flags.polarity,
- intsrc->flags.trigger,
- intsrc->global_irq);
-
- return 0;
-}
-
-
-static int __init
-acpi_parse_nmi_src (
- acpi_table_entry_header *header)
-{
- struct acpi_table_nmi_src *nmi_src = NULL;
-
- nmi_src = (struct acpi_table_nmi_src*) header;
- if (!nmi_src)
- return -EINVAL;
-
- acpi_table_print_madt_entry(header);
-
- /* TBD: Support nimsrc entries? */
-
- return 0;
-}
-
-#endif /*CONFIG_X86_IO_APIC*/
-
-
-static unsigned long __init
-acpi_scan_rsdp (
- unsigned long start,
- unsigned long length)
-{
- unsigned long offset = 0;
- unsigned long sig_len = sizeof("RSD PTR ") - 1;
-
- /*
- * Scan all 16-byte boundaries of the physical memory region for the
- * RSDP signature.
- */
- for (offset = 0; offset < length; offset += 16) {
- if (0 != strncmp((char *) (start + offset), "RSD PTR ", sig_len))
- continue;
- return (start + offset);
- }
-
- return 0;
-}
-
-
-unsigned long __init
-acpi_find_rsdp (void)
-{
- unsigned long rsdp_phys = 0;
-
- /*
- * Scan memory looking for the RSDP signature. First search EBDA (low
- * memory) paragraphs and then search upper memory (E0000-FFFFF).
- */
- rsdp_phys = acpi_scan_rsdp (0, 0x400);
- if (!rsdp_phys)
- rsdp_phys = acpi_scan_rsdp (0xE0000, 0xFFFFF);
-
- return rsdp_phys;
-}
-
-
-int __init
-acpi_boot_init (
- char *cmdline)
-{
- int result = 0;
-
- /*
- * The default interrupt routing model is PIC (8259). This gets
- * overriden if IOAPICs are enumerated (below).
- */
- acpi_irq_model = ACPI_IRQ_MODEL_PIC;
-
- /*
- * Initialize the ACPI boot-time table parser.
- */
- result = acpi_table_init(cmdline);
- if (0 != result)
- return result;
-
-#ifdef CONFIG_X86_LOCAL_APIC
-
- /*
- * MADT
- * ----
- * Parse the Multiple APIC Description Table (MADT), if exists.
- * Note that this table provides platform SMP configuration
- * information -- the successor to MPS tables.
- */
-
- result = acpi_table_parse(ACPI_APIC, acpi_parse_madt);
- if (0 == result) {
- printk(KERN_WARNING PREFIX "MADT not present\n");
- return 0;
- }
- else if (0 > result) {
- printk(KERN_ERR PREFIX "Error parsing MADT\n");
- return result;
- }
- else if (1 < result)
- printk(KERN_WARNING PREFIX "Multiple MADT tables exist\n");
-
- /*
- * Local APIC
- * ----------
- * Note that the LAPIC address is obtained from the MADT (32-bit value)
- * and (optionally) overriden by a LAPIC_ADDR_OVR entry (64-bit value).
- */
-
- result = acpi_table_parse_madt(ACPI_MADT_LAPIC_ADDR_OVR, acpi_parse_lapic_addr_ovr);
- if (0 > result) {
- printk(KERN_ERR PREFIX "Error parsing LAPIC address override entry\n");
- return result;
- }
-
- mp_register_lapic_address(acpi_lapic_addr);
-
- result = acpi_table_parse_madt(ACPI_MADT_LAPIC, acpi_parse_lapic);
- if (0 == result) {
- printk(KERN_ERR PREFIX "No LAPIC entries present\n");
- /* TBD: Cleanup to allow fallback to MPS */
- return -ENODEV;
- }
- else if (0 > result) {
- printk(KERN_ERR PREFIX "Error parsing LAPIC entry\n");
- /* TBD: Cleanup to allow fallback to MPS */
- return result;
- }
-
- result = acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi);
- if (0 > result) {
- printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n");
- /* TBD: Cleanup to allow fallback to MPS */
- return result;
- }
-
- acpi_lapic = 1;
-
-#endif /*CONFIG_X86_LOCAL_APIC*/
-
-#ifdef CONFIG_X86_IO_APIC
-
- /*
- * I/O APIC
- * --------
- */
-
- result = acpi_table_parse_madt(ACPI_MADT_IOAPIC, acpi_parse_ioapic);
- if (0 == result) {
- printk(KERN_ERR PREFIX "No IOAPIC entries present\n");
- return -ENODEV;
- }
- else if (0 > result) {
- printk(KERN_ERR PREFIX "Error parsing IOAPIC entry\n");
- return result;
- }
-
- /* Build a default routing table for legacy (ISA) interrupts. */
- mp_config_acpi_legacy_irqs();
-
- result = acpi_table_parse_madt(ACPI_MADT_INT_SRC_OVR, acpi_parse_int_src_ovr);
- if (0 > result) {
- printk(KERN_ERR PREFIX "Error parsing interrupt source overrides entry\n");
- /* TBD: Cleanup to allow fallback to MPS */
- return result;
- }
-
- result = acpi_table_parse_madt(ACPI_MADT_NMI_SRC, acpi_parse_nmi_src);
- if (0 > result) {
- printk(KERN_ERR PREFIX "Error parsing NMI SRC entry\n");
- /* TBD: Cleanup to allow fallback to MPS */
- return result;
- }
-
- acpi_irq_model = ACPI_IRQ_MODEL_IOAPIC;
-
- acpi_ioapic = 1;
-
-#endif /*CONFIG_X86_IO_APIC*/
-
-#ifdef CONFIG_X86_LOCAL_APIC
- if (acpi_lapic && acpi_ioapic)
- smp_found_config = 1;
-#endif
-
- return 0;
-}
-
-int
-acpi_register_irq (
- u32 gsi,
- u32 polarity,
- u32 mode)
-{
- return gsi;
-}
-
-#endif /*CONFIG_ACPI_BOOT*/
-
-
-/* --------------------------------------------------------------------------
- Low-Level Sleep Support
- -------------------------------------------------------------------------- */
-
-#ifdef CONFIG_ACPI_SLEEP
-
-#define DEBUG
-
-#ifdef DEBUG
-#include
-#endif
-
-/* address in low memory of the wakeup routine. */
-unsigned long acpi_wakeup_address = 0;
-
-/* new page directory that we will be using */
-static pmd_t *pmd;
-
-/* saved page directory */
-static pmd_t saved_pmd;
-
-/* page which we'll use for the new page directory */
-static pte_t *ptep;
-
-extern unsigned long FASTCALL(acpi_copy_wakeup_routine(unsigned long));
-
-/*
- * acpi_create_identity_pmd
- *
- * Create a new, identity mapped pmd.
- *
- * Do this by creating new page directory, and marking all the pages as R/W
- * Then set it as the new Page Middle Directory.
- * And, of course, flush the TLB so it takes effect.
- *
- * We save the address of the old one, for later restoration.
- */
-static void acpi_create_identity_pmd (void)
-{
- pgd_t *pgd;
- int i;
-
- ptep = (pte_t*)__get_free_page(GFP_KERNEL);
-
- /* fill page with low mapping */
- for (i = 0; i < PTRS_PER_PTE; i++)
- set_pte(ptep + i, mk_pte_phys(i << PAGE_SHIFT, PAGE_SHARED));
-
- pgd = pgd_offset(current->active_mm, 0);
- pmd = pmd_alloc(current->mm,pgd, 0);
-
- /* save the old pmd */
- saved_pmd = *pmd;
-
- /* set the new one */
- set_pmd(pmd, __pmd(_PAGE_TABLE + __pa(ptep)));
-
- /* flush the TLB */
- local_flush_tlb();
-}
-
-/*
- * acpi_restore_pmd
- *
- * Restore the old pmd saved by acpi_create_identity_pmd and
- * free the page that said function alloc'd
- */
-static void acpi_restore_pmd (void)
-{
- set_pmd(pmd, saved_pmd);
- local_flush_tlb();
- free_page((unsigned long)ptep);
-}
-
-/**
- * acpi_save_state_mem - save kernel state
- *
- * Create an identity mapped page table and copy the wakeup routine to
- * low memory.
- */
-int acpi_save_state_mem (void)
-{
- acpi_create_identity_pmd();
- acpi_copy_wakeup_routine(acpi_wakeup_address);
-
- return 0;
-}
-
-/**
- * acpi_save_state_disk - save kernel state to disk
- *
- */
-int acpi_save_state_disk (void)
-{
- return 1;
-}
-
-/*
- * acpi_restore_state
- */
-void acpi_restore_state_mem (void)
-{
- acpi_restore_pmd();
-}
-
-/**
- * acpi_reserve_bootmem - do _very_ early ACPI initialisation
- *
- * We allocate a page in low memory for the wakeup
- * routine for when we come back from a sleep state. The
- * runtime allocator allows specification of <16M pages, but not
- * <1M pages.
- */
-void __init acpi_reserve_bootmem(void)
-{
- acpi_wakeup_address = (unsigned long)alloc_bootmem_low(PAGE_SIZE);
- printk(KERN_DEBUG "ACPI: have wakeup address 0x%8.8lx\n", acpi_wakeup_address);
-}
-
-#endif /*CONFIG_ACPI_SLEEP*/
-
diff -Nru a/arch/i386/kernel/acpi_wakeup.S b/arch/i386/kernel/acpi_wakeup.S
--- a/arch/i386/kernel/acpi_wakeup.S Wed Oct 8 09:05:45 2003
+++ /dev/null Wed Dec 31 16:00:00 1969
@@ -1,139 +0,0 @@
-
-.text
-#include
-#include
-
-
-ALIGN
-wakeup_start:
-wakeup_code:
- wakeup_code_start = .
- .code16
-
- cli
- cld
-
- # setup data segment
- movw %cs, %ax
-
- addw $(wakeup_data - wakeup_code) >> 4, %ax
- movw %ax, %ds
- movw %ax, %ss
- mov $(wakeup_stack - wakeup_data), %sp # Private stack is needed for ASUS board
-
- # set up page table
- movl (real_save_cr3 - wakeup_data), %eax
- movl %eax, %cr3
-
- # make sure %cr4 is set correctly (features, etc)
- movl (real_save_cr4 - wakeup_data), %eax
- movl %eax, %cr4
-
- # need a gdt
- lgdt real_save_gdt - wakeup_data
-
- movl %cr0, %eax
- orl $0x80000001, %eax
- movl %eax, %cr0
-
- ljmpl $__KERNEL_CS,$SYMBOL_NAME(wakeup_pmode_return)
-
- .code32
- ALIGN
-
-.org 0x100
-wakeup_data:
- .word 0
-real_save_gdt: .word 0
- .long 0
-real_save_cr3: .long 0
-real_save_cr4: .long 0
-
-.org 0x300
-wakeup_stack:
-wakeup_end:
-
-wakeup_pmode_return:
- # restore data segment
- movl $__KERNEL_DS, %eax
- movw %ax, %ds
- movw %ax, %es
-
- # and restore the stack
- movw %ax, %ss
- movl saved_esp, %esp
-
- # restore other segment registers
- xorl %eax, %eax
- movw %ax, %fs
- movw %ax, %gs
-
- # reload the gdt, as we need the full 32 bit address
- lgdt saved_gdt
- lidt saved_idt
- lldt saved_ldt
-
- # restore the other general registers
- movl saved_ebx, %ebx
- movl saved_edi, %edi
- movl saved_esi, %esi
- movl saved_ebp, %ebp
-
- # jump to place where we left off
- movl saved_eip,%eax
- jmp *%eax
-
-##
-# acpi_copy_wakeup_routine
-#
-# Copy the above routine to low memory.
-#
-# Parameters:
-# %eax: place to copy wakeup routine to
-#
-# Returned address is location of code in low memory (past data and stack)
-#
-ENTRY(acpi_copy_wakeup_routine)
-
- pushl %esi
- pushl %edi
-
- sgdt saved_gdt
- sidt saved_idt
- sldt saved_ldt
- str saved_tss
-
- movl %eax, %edi
- leal wakeup_start, %esi
- movl $(wakeup_end - wakeup_start) >> 2, %ecx
-
- rep ; movsl
-
- movl %cr3, %edx
- movl %edx, real_save_cr3 - wakeup_start (%eax)
- movl %cr4, %edx
- movl %edx, real_save_cr4 - wakeup_start (%eax)
- sgdt real_save_gdt - wakeup_start (%eax)
-
- # restore the regs we used
- popl %edi
- popl %esi
- ret
-
-
-.data
-ALIGN
-# saved registers
-saved_gdt: .long 0,0
-saved_idt: .long 0,0
-saved_ldt: .long 0
-saved_tss: .long 0
-saved_cr0: .long 0
-
-ENTRY(saved_ebp) .long 0
-ENTRY(saved_esi) .long 0
-ENTRY(saved_edi) .long 0
-ENTRY(saved_ebx) .long 0
-
-ENTRY(saved_eip) .long 0
-ENTRY(saved_esp) .long 0
diff -Nru a/arch/i386/kernel/pci-pc.c b/arch/i386/kernel/pci-pc.c
--- a/arch/i386/kernel/pci-pc.c Wed Oct 8 09:05:45 2003
+++ b/arch/i386/kernel/pci-pc.c Wed Oct 8 09:05:45 2003
@@ -29,6 +29,8 @@
int (*pci_config_read)(int seg, int bus, int dev, int fn, int reg, int len, u32 *value) = NULL;
int (*pci_config_write)(int seg, int bus, int dev, int fn, int reg, int len, u32 value) = NULL;
+static int pci_using_acpi_prt = 0;
+
#ifdef CONFIG_MULTIQUAD
#define BUS2QUAD(global) (mp_bus_id_to_node[global])
#define BUS2LOCAL(global) (mp_bus_id_to_local[global])
@@ -39,8 +41,6 @@
#define QUADLOCAL2BUS(quad,local) (local)
#endif
-static int pci_using_acpi_prt = 0;
-
/*
* This interrupt-safe spinlock protects all accesses to PCI
* configuration space.
@@ -1414,6 +1414,8 @@
return;
}
+int use_acpi_pci __initdata = 1;
+
void __init pcibios_init(void)
{
int quad;
@@ -1425,25 +1427,28 @@
return;
}
+ printk(KERN_INFO "PCI: Probing PCI hardware\n");
#ifdef CONFIG_ACPI_PCI
- if (acpi_pci_irq_init() > 0)
+ if (use_acpi_pci && !acpi_pci_irq_init()) {
pci_using_acpi_prt = 1;
+ printk(KERN_INFO "PCI: Using ACPI for IRQ routing\n");
+ printk(KERN_INFO "PCI: if you experience problems, try using option 'pci=noacpi' or even 'acpi=off'\n");
+ }
#endif
if (!pci_using_acpi_prt) {
- pci_root_bus = pci_scan_bus(0, pci_root_ops, NULL);
- if (clustered_apic_mode && (numnodes > 1)) {
- for (quad = 1; quad < numnodes; ++quad) {
- printk("Scanning PCI bus %d for quad %d\n",
- QUADLOCAL2BUS(quad,0), quad);
- pci_scan_bus(QUADLOCAL2BUS(quad,0),
- pci_root_ops, NULL);
- }
- }
-
+ pci_root_bus = pcibios_scan_root(0);
pcibios_irq_init();
pcibios_fixup_peer_bridges();
pcibios_fixup_irqs();
}
+ if (clustered_apic_mode && (numnodes > 1)) {
+ for (quad = 1; quad < numnodes; ++quad) {
+ printk("Scanning PCI bus %d for quad %d\n",
+ QUADLOCAL2BUS(quad,0), quad);
+ pci_scan_bus(QUADLOCAL2BUS(quad,0),
+ pci_root_ops, NULL);
+ }
+ }
pcibios_resource_survey();
@@ -1495,6 +1500,9 @@
return NULL;
} else if (!strncmp(str, "lastbus=", 8)) {
pcibios_last_bus = simple_strtol(str+8, NULL, 0);
+ return NULL;
+ } else if (!strncmp(str, "noacpi", 6)) {
+ use_acpi_pci = 0;
return NULL;
}
return str;
diff -Nru a/arch/ia64/config.in b/arch/ia64/config.in
--- a/arch/ia64/config.in Wed Oct 8 09:05:45 2003
+++ b/arch/ia64/config.in Wed Oct 8 09:05:45 2003
@@ -86,6 +86,32 @@
define_bool CONFIG_KCORE_ELF y # On IA-64, we always want an ELF /proc/kcore.
+define_int CONFIG_FORCE_MAX_ZONEORDER 19
+
+bool 'IA-64 Huge TLB Page Support' CONFIG_HUGETLB_PAGE
+
+if [ "$CONFIG_HUGETLB_PAGE" = "y" ]; then
+ if [ "$CONFIG_MCKINLEY" = "y" ]; then
+ choice ' IA-64 Huge TLB Page Size' \
+ "4GB CONFIG_HUGETLB_PAGE_SIZE_4GB \
+ 1GB CONFIG_HUGETLB_PAGE_SIZE_1GB \
+ 256MB CONFIG_HUGETLB_PAGE_SIZE_256MB \
+ 64MB CONFIG_HUGETLB_PAGE_SIZE_64MB \
+ 16MB CONFIG_HUGETLB_PAGE_SIZE_16MB \
+ 4MB CONFIG_HUGETLB_PAGE_SIZE_4MB \
+ 1MB CONFIG_HUGETLB_PAGE_SIZE_1MB \
+ 256KB CONFIG_HUGETLB_PAGE_SIZE_256KB" 16MB
+ else
+ choice ' IA-64 Huge TLB Page Size' \
+ "256MB CONFIG_HUGETLB_PAGE_SIZE_256MB \
+ 64MB CONFIG_HUGETLB_PAGE_SIZE_64MB \
+ 16MB CONFIG_HUGETLB_PAGE_SIZE_16MB \
+ 4MB CONFIG_HUGETLB_PAGE_SIZE_4MB \
+ 1MB CONFIG_HUGETLB_PAGE_SIZE_1MB \
+ 256KB CONFIG_HUGETLB_PAGE_SIZE_256KB" 16MB
+ fi
+fi
+
bool 'SMP support' CONFIG_SMP
tristate 'Support running of Linux/x86 binaries' CONFIG_IA32_SUPPORT
bool 'Performance monitor support' CONFIG_PERFMON
diff -Nru a/arch/ia64/hp/common/sba_iommu.c b/arch/ia64/hp/common/sba_iommu.c
--- a/arch/ia64/hp/common/sba_iommu.c Wed Oct 8 09:05:45 2003
+++ b/arch/ia64/hp/common/sba_iommu.c Wed Oct 8 09:05:45 2003
@@ -133,6 +133,7 @@
#define ZX1_IOC_ID ((PCI_DEVICE_ID_HP_ZX1_IOC << 16) | PCI_VENDOR_ID_HP)
#define REO_IOC_ID ((PCI_DEVICE_ID_HP_REO_IOC << 16) | PCI_VENDOR_ID_HP)
+#define SX1000_IOC_ID ((PCI_DEVICE_ID_HP_SX1000_IOC << 16) | PCI_VENDOR_ID_HP)
#define ZX1_IOC_OFFSET 0x1000 /* ACPI reports SBA, we want IOC */
@@ -1636,6 +1637,7 @@
static struct ioc_iommu ioc_iommu_info[] __initdata = {
{ ZX1_IOC_ID, "zx1", ioc_zx1_init },
{ REO_IOC_ID, "REO" },
+ { SX1000_IOC_ID, "sx1000" },
};
static struct ioc * __init
diff -Nru a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
--- a/arch/ia64/kernel/acpi.c Wed Oct 8 09:05:45 2003
+++ b/arch/ia64/kernel/acpi.c Wed Oct 8 09:05:45 2003
@@ -631,4 +631,21 @@
return gsi_to_vector(irq);
}
+int
+acpi_register_irq (u32 gsi, u32 polarity, u32 mode)
+{
+ int vector = 0;
+
+ if (has_8259 && gsi < 16)
+ return isa_irq_to_vector(gsi);
+
+ if (!iosapic_register_intr)
+ return 0;
+
+ /* Turn it on */
+ vector = iosapic_register_intr(gsi, polarity ? IOSAPIC_POL_HIGH : IOSAPIC_POL_LOW,
+ mode ? IOSAPIC_EDGE : IOSAPIC_LEVEL);
+ return vector;
+}
+
#endif /* CONFIG_ACPI_BOOT */
diff -Nru a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c
--- a/arch/ia64/kernel/setup.c Wed Oct 8 09:05:45 2003
+++ b/arch/ia64/kernel/setup.c Wed Oct 8 09:05:45 2003
@@ -40,6 +40,7 @@
#include
#include
#include
+#include
#ifdef CONFIG_BLK_DEV_RAM
# include
@@ -58,6 +59,7 @@
struct cpuinfo_ia64 *boot_cpu_data;
#else
struct cpuinfo_ia64 _cpu_data[NR_CPUS] __attribute__ ((section ("__special_page_section")));
+ mmu_gather_t mmu_gathers[NR_CPUS];
#endif
unsigned long ia64_cycles_per_usec;
@@ -567,6 +569,8 @@
for (cpu = 1; cpu < NR_CPUS; ++cpu)
memcpy(my_cpu_data->cpu_data[cpu]->cpu_data,
my_cpu_data->cpu_data, sizeof(my_cpu_data->cpu_data));
+ my_cpu_data->mmu_gathers = alloc_bootmem_pages_node(BOOT_NODE_DATA(boot_get_local_cnodeid()),
+ sizeof(mmu_gather_t));
} else {
order = get_order(sizeof(struct cpuinfo_ia64));
my_cpu_data = page_address(alloc_pages_node(numa_node_id(), GFP_KERNEL, order));
@@ -576,9 +580,14 @@
order);
for (cpu = 0; cpu < NR_CPUS; ++cpu)
boot_cpu_data->cpu_data[cpu]->cpu_data[smp_processor_id()] = my_cpu_data;
+
+ my_cpu_data->mmu_gathers = page_address(boot_alloc_pages_node(boot_get_local_cnodeid(),
+ GFP_KERNEL,
+ get_order(sizeof(mmu_gather_t)));
}
#else
my_cpu_data = cpu_data(smp_processor_id());
+ my_cpu_data->mmu_gathers = &mmu_gathers[smp_processor_id()];
#endif
/*
diff -Nru a/arch/ia64/kernel/sys_ia64.c b/arch/ia64/kernel/sys_ia64.c
--- a/arch/ia64/kernel/sys_ia64.c Wed Oct 8 09:05:45 2003
+++ b/arch/ia64/kernel/sys_ia64.c Wed Oct 8 09:05:45 2003
@@ -61,16 +61,14 @@
}
asmlinkage long
-ia64_getpriority (int which, int who, long arg2, long arg3, long arg4, long arg5, long arg6,
- long arg7, long stack)
+ia64_getpriority (int which, int who)
{
- struct pt_regs *regs = (struct pt_regs *) &stack;
extern long sys_getpriority (int, int);
long prio;
prio = sys_getpriority(which, who);
if (prio >= 0) {
- regs->r8 = 0; /* ensure negative priority is not mistaken as error code */
+ force_successful_syscall_return();
prio = 20 - prio;
}
return prio;
@@ -84,11 +82,9 @@
}
asmlinkage unsigned long
-ia64_shmat (int shmid, void *shmaddr, int shmflg, long arg3, long arg4, long arg5, long arg6,
- long arg7, long stack)
+ia64_shmat (int shmid, void *shmaddr, int shmflg)
{
extern int sys_shmat (int shmid, char *shmaddr, int shmflg, ulong *raddr);
- struct pt_regs *regs = (struct pt_regs *) &stack;
unsigned long raddr;
int retval;
@@ -96,16 +92,14 @@
if (retval < 0)
return retval;
- regs->r8 = 0; /* ensure negative addresses are not mistaken as an error code */
+ force_successful_syscall_return();
return raddr;
}
asmlinkage unsigned long
-ia64_brk (unsigned long brk, long arg1, long arg2, long arg3,
- long arg4, long arg5, long arg6, long arg7, long stack)
+ia64_brk (unsigned long brk)
{
extern int vm_enough_memory (long pages);
- struct pt_regs *regs = (struct pt_regs *) &stack;
unsigned long rlim, retval, newbrk, oldbrk;
struct mm_struct *mm = current->mm;
@@ -155,7 +149,7 @@
out:
retval = mm->brk;
up_write(&mm->mmap_sem);
- regs->r8 = 0; /* ensure large retval isn't mistaken as error code */
+ force_successful_syscall_return();
return retval;
}
@@ -232,29 +226,23 @@
* of) files that are larger than the address space of the CPU.
*/
asmlinkage unsigned long
-sys_mmap2 (unsigned long addr, unsigned long len, int prot, int flags, int fd, long pgoff,
- long arg6, long arg7, long stack)
+sys_mmap2 (unsigned long addr, unsigned long len, int prot, int flags, int fd, long pgoff)
{
- struct pt_regs *regs = (struct pt_regs *) &stack;
-
addr = do_mmap2(addr, len, prot, flags, fd, pgoff);
if (!IS_ERR((void *) addr))
- regs->r8 = 0; /* ensure large addresses are not mistaken as failures... */
+ force_successful_syscall_return();
return addr;
}
asmlinkage unsigned long
-sys_mmap (unsigned long addr, unsigned long len, int prot, int flags,
- int fd, long off, long arg6, long arg7, long stack)
+sys_mmap (unsigned long addr, unsigned long len, int prot, int flags, int fd, long off)
{
- struct pt_regs *regs = (struct pt_regs *) &stack;
-
if ((off & ~PAGE_MASK) != 0)
return -EINVAL;
addr = do_mmap2(addr, len, prot, flags, fd, off >> PAGE_SHIFT);
if (!IS_ERR((void *) addr))
- regs->r8 = 0; /* ensure large addresses are not mistaken as failures... */
+ force_successful_syscall_return();
return addr;
}
diff -Nru a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
--- a/arch/ia64/mm/init.c Wed Oct 8 09:05:45 2003
+++ b/arch/ia64/mm/init.c Wed Oct 8 09:05:45 2003
@@ -252,7 +252,7 @@
pte_t *pte;
if (!PageReserved(page))
- printk("put_gate_page: gate page at 0x%p not in reserved memory\n",
+ printk(KERN_ERR "put_gate_page: gate page at 0x%p not in reserved memory\n",
page_address(page));
pgd = pgd_offset_k(address); /* note: this is NOT pgd_offset()! */
@@ -557,7 +557,7 @@
efi_memmap_walk(create_mem_map_page_table, 0);
free_area_init_node(0, NULL, vmem_map, zones_size, 0, zholes_size);
- printk("Virtual mem_map starts at 0x%p\n", mem_map);
+ printk(KERN_INFO "Virtual mem_map starts at 0x%p\n", mem_map);
}
#endif
}
diff -Nru a/drivers/acpi/ac.c b/drivers/acpi/ac.c
--- a/drivers/acpi/ac.c Wed Oct 8 09:05:45 2003
+++ /dev/null Wed Dec 31 16:00:00 1969
@@ -1,352 +0,0 @@
-/*
- * acpi_ac.c - ACPI AC Adapter Driver ($Revision: 23 $)
- *
- * Copyright (C) 2001, 2002 Andy Grover
- * Copyright (C) 2001, 2002 Paul Diefenbaugh
- *
- * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at
- * your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- *
- * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- */
-
-#include
-#include
-#include
-#include
-#include "acpi_bus.h"
-#include "acpi_drivers.h"
-
-
-#define _COMPONENT ACPI_AC_COMPONENT
-ACPI_MODULE_NAME ("acpi_ac")
-
-MODULE_AUTHOR("Paul Diefenbaugh");
-MODULE_DESCRIPTION(ACPI_AC_DRIVER_NAME);
-MODULE_LICENSE("GPL");
-
-#define PREFIX "ACPI: "
-
-
-int acpi_ac_add (struct acpi_device *device);
-int acpi_ac_remove (struct acpi_device *device, int type);
-
-static struct acpi_driver acpi_ac_driver = {
- name: ACPI_AC_DRIVER_NAME,
- class: ACPI_AC_CLASS,
- ids: ACPI_AC_HID,
- ops: {
- add: acpi_ac_add,
- remove: acpi_ac_remove,
- },
-};
-
-struct acpi_ac {
- acpi_handle handle;
- unsigned long state;
-};
-
-
-/* --------------------------------------------------------------------------
- AC Adapter Management
- -------------------------------------------------------------------------- */
-
-static int
-acpi_ac_get_state (
- struct acpi_ac *ac)
-{
- acpi_status status = AE_OK;
-
- ACPI_FUNCTION_TRACE("acpi_ac_get_state");
-
- if (!ac)
- return_VALUE(-EINVAL);
-
- status = acpi_evaluate_integer(ac->handle, "_PSR", NULL, &ac->state);
- if (ACPI_FAILURE(status)) {
- ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
- "Error reading AC Adapter state\n"));
- ac->state = ACPI_AC_STATUS_UNKNOWN;
- return_VALUE(-ENODEV);
- }
-
- return_VALUE(0);
-}
-
-
-/* --------------------------------------------------------------------------
- FS Interface (/proc)
- -------------------------------------------------------------------------- */
-
-#include
-#include
-
-struct proc_dir_entry *acpi_ac_dir = NULL;
-
-static int
-acpi_ac_read_state (
- char *page,
- char **start,
- off_t off,
- int count,
- int *eof,
- void *data)
-{
- struct acpi_ac *ac = (struct acpi_ac *) data;
- char *p = page;
- int len = 0;
-
- ACPI_FUNCTION_TRACE("acpi_ac_read_state");
-
- if (!ac || (off != 0))
- goto end;
-
- if (0 != acpi_ac_get_state(ac)) {
- p += sprintf(p, "ERROR: Unable to read AC Adapter state\n");
- goto end;
- }
-
- p += sprintf(p, "state: ");
- switch (ac->state) {
- case ACPI_AC_STATUS_OFFLINE:
- p += sprintf(p, "off-line\n");
- break;
- case ACPI_AC_STATUS_ONLINE:
- p += sprintf(p, "on-line\n");
- break;
- default:
- p += sprintf(p, "unknown\n");
- break;
- }
-
-end:
- len = (p - page);
- if (len <= off+count) *eof = 1;
- *start = page + off;
- len -= off;
- if (len>count) len = count;
- if (len<0) len = 0;
-
- return_VALUE(len);
-}
-
-
-static int
-acpi_ac_add_fs (
- struct acpi_device *device)
-{
- struct proc_dir_entry *entry = NULL;
-
- ACPI_FUNCTION_TRACE("acpi_ac_add_fs");
-
- if (!acpi_ac_dir) {
- acpi_ac_dir = proc_mkdir(ACPI_AC_CLASS, acpi_root_dir);
- if (!acpi_ac_dir)
- return_VALUE(-ENODEV);
- }
-
- if (!acpi_device_dir(device)) {
- acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
- acpi_ac_dir);
- if (!acpi_device_dir(device))
- return_VALUE(-ENODEV);
- }
-
- /* 'state' [R] */
- entry = create_proc_entry(ACPI_AC_FILE_STATE,
- S_IRUGO, acpi_device_dir(device));
- if (!entry)
- ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
- "Unable to create '%s' fs entry\n",
- ACPI_AC_FILE_STATE));
- else {
- entry->read_proc = acpi_ac_read_state;
- entry->data = acpi_driver_data(device);
- }
-
- return_VALUE(0);
-}
-
-
-static int
-acpi_ac_remove_fs (
- struct acpi_device *device)
-{
- ACPI_FUNCTION_TRACE("acpi_ac_remove_fs");
-
- if (!acpi_ac_dir)
- return_VALUE(-ENODEV);
-
- if (acpi_device_dir(device))
- remove_proc_entry(acpi_device_bid(device), acpi_ac_dir);
-
- return_VALUE(0);
-}
-
-
-/* --------------------------------------------------------------------------
- Driver Model
- -------------------------------------------------------------------------- */
-
-void
-acpi_ac_notify (
- acpi_handle handle,
- u32 event,
- void *data)
-{
- struct acpi_ac *ac = (struct acpi_ac *) data;
- struct acpi_device *device = NULL;
-
- ACPI_FUNCTION_TRACE("acpi_ac_notify");
-
- if (!ac)
- return;
-
- if (0 != acpi_bus_get_device(ac->handle, &device))
- return_VOID;
-
- switch (event) {
- case ACPI_AC_NOTIFY_STATUS:
- acpi_ac_get_state(ac);
- acpi_bus_generate_event(device, event, (u32) ac->state);
- break;
- default:
- ACPI_DEBUG_PRINT((ACPI_DB_INFO,
- "Unsupported event [0x%x]\n", event));
- break;
- }
-
- return_VOID;
-}
-
-
-int
-acpi_ac_add (
- struct acpi_device *device)
-{
- int result = 0;
- acpi_status status = AE_OK;
- struct acpi_ac *ac = NULL;
-
- ACPI_FUNCTION_TRACE("acpi_ac_add");
-
- if (!device)
- return_VALUE(-EINVAL);
-
- ac = kmalloc(sizeof(struct acpi_ac), GFP_KERNEL);
- if (!ac)
- return_VALUE(-ENOMEM);
- memset(ac, 0, sizeof(struct acpi_ac));
-
- ac->handle = device->handle;
- sprintf(acpi_device_name(device), "%s", ACPI_AC_DEVICE_NAME);
- sprintf(acpi_device_class(device), "%s", ACPI_AC_CLASS);
- acpi_driver_data(device) = ac;
-
- result = acpi_ac_get_state(ac);
- if (0 != result)
- goto end;
-
- result = acpi_ac_add_fs(device);
- if (0 != result)
- goto end;
-
- status = acpi_install_notify_handler(ac->handle,
- ACPI_DEVICE_NOTIFY, acpi_ac_notify, ac);
- if (ACPI_FAILURE(status)) {
- ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
- "Error installing notify handler\n"));
- result = -ENODEV;
- goto end;
- }
-
- printk(KERN_INFO PREFIX "%s [%s] (%s)\n",
- acpi_device_name(device), acpi_device_bid(device),
- ac->state?"on-line":"off-line");
-
-end:
- if (0 != result) {
- acpi_ac_remove_fs(device);
- kfree(ac);
- }
-
- return_VALUE(result);
-}
-
-
-int
-acpi_ac_remove (
- struct acpi_device *device,
- int type)
-{
- acpi_status status = AE_OK;
- struct acpi_ac *ac = NULL;
-
- ACPI_FUNCTION_TRACE("acpi_ac_remove");
-
- if (!device || !acpi_driver_data(device))
- return_VALUE(-EINVAL);
-
- ac = (struct acpi_ac *) acpi_driver_data(device);
-
- status = acpi_remove_notify_handler(ac->handle,
- ACPI_DEVICE_NOTIFY, acpi_ac_notify);
- if (ACPI_FAILURE(status))
- ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
- "Error removing notify handler\n"));
-
- acpi_ac_remove_fs(device);
-
- kfree(ac);
-
- return_VALUE(0);
-}
-
-
-int __init
-acpi_ac_init (void)
-{
- int result = 0;
-
- ACPI_FUNCTION_TRACE("acpi_ac_init");
-
- result = acpi_bus_register_driver(&acpi_ac_driver);
- if (0 > result) {
- remove_proc_entry(ACPI_AC_CLASS, acpi_root_dir);
- return_VALUE(-ENODEV);
- }
-
- return_VALUE(0);
-}
-
-
-void __exit
-acpi_ac_exit (void)
-{
- int result = 0;
-
- ACPI_FUNCTION_TRACE("acpi_ac_exit");
-
- result = acpi_bus_unregister_driver(&acpi_ac_driver);
- if (0 == result)
- remove_proc_entry(ACPI_AC_CLASS, acpi_root_dir);
-
- return_VOID;
-}
-
-
-module_init(acpi_ac_init);
-module_exit(acpi_ac_exit);
diff -Nru a/drivers/acpi/battery.c b/drivers/acpi/battery.c
--- a/drivers/acpi/battery.c Wed Oct 8 09:05:45 2003
+++ /dev/null Wed Dec 31 16:00:00 1969
@@ -1,831 +0,0 @@
-/*
- * acpi_battery.c - ACPI Battery Driver ($Revision: 32 $)
- *
- * Copyright (C) 2001, 2002 Andy Grover
- * Copyright (C) 2001, 2002 Paul Diefenbaugh
- *
- * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at
- * your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- *
- * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- */
-
-#include
-#include
-#include
-#include
-#include "acpi_bus.h"
-#include "acpi_drivers.h"
-
-
-#define _COMPONENT ACPI_BATTERY_COMPONENT
-ACPI_MODULE_NAME ("acpi_battery")
-
-MODULE_AUTHOR("Paul Diefenbaugh");
-MODULE_DESCRIPTION(ACPI_BATTERY_DRIVER_NAME);
-MODULE_LICENSE("GPL");
-
-#define PREFIX "ACPI: "
-
-
-#define ACPI_BATTERY_VALUE_UNKNOWN 0xFFFFFFFF
-
-#define ACPI_BATTERY_FORMAT_BIF "NNNNNNNNNSSSS"
-#define ACPI_BATTERY_FORMAT_BST "NNNN"
-
-static int acpi_battery_add (struct acpi_device *device);
-static int acpi_battery_remove (struct acpi_device *device, int type);
-
-static struct acpi_driver acpi_battery_driver = {
- name: ACPI_BATTERY_DRIVER_NAME,
- class: ACPI_BATTERY_CLASS,
- ids: ACPI_BATTERY_HID,
- ops: {
- add: acpi_battery_add,
- remove: acpi_battery_remove,
- },
-};
-
-struct acpi_battery_status {
- acpi_integer state;
- acpi_integer present_rate;
- acpi_integer remaining_capacity;
- acpi_integer present_voltage;
-};
-
-struct acpi_battery_info {
- acpi_integer power_unit;
- acpi_integer design_capacity;
- acpi_integer last_full_capacity;
- acpi_integer battery_technology;
- acpi_integer design_voltage;
- acpi_integer design_capacity_warning;
- acpi_integer design_capacity_low;
- acpi_integer battery_capacity_granularity_1;
- acpi_integer battery_capacity_granularity_2;
- acpi_string model_number;
- acpi_string serial_number;
- acpi_string battery_type;
- acpi_string oem_info;
-};
-
-struct acpi_battery_flags {
- u8 present:1; /* Bay occupied? */
- u8 power_unit:1; /* 0=watts, 1=apms */
- u8 alarm:1; /* _BTP present? */
- u8 reserved:5;
-};
-
-struct acpi_battery_trips {
- unsigned long warning;
- unsigned long low;
-};
-
-struct acpi_battery {
- acpi_handle handle;
- struct acpi_battery_flags flags;
- struct acpi_battery_trips trips;
- unsigned long alarm;
- struct acpi_battery_info *info;
-};
-
-
-/* --------------------------------------------------------------------------
- Battery Management
- -------------------------------------------------------------------------- */
-
-static int
-acpi_battery_get_info (
- struct acpi_battery *battery,
- struct acpi_battery_info **bif)
-{
- int result = 0;
- acpi_status status = 0;
- acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL};
- acpi_buffer format = {sizeof(ACPI_BATTERY_FORMAT_BIF),
- ACPI_BATTERY_FORMAT_BIF};
- acpi_buffer data = {0, NULL};
- acpi_object *package = NULL;
-
- ACPI_FUNCTION_TRACE("acpi_battery_get_info");
-
- if (!battery || !bif)
- return_VALUE(-EINVAL);
-
- /* Evalute _BIF */
-
- status = acpi_evaluate_object(battery->handle, "_BIF", NULL, &buffer);
- if (ACPI_FAILURE(status)) {
- ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _BIF\n"));
- return_VALUE(-ENODEV);
- }
-
- package = (acpi_object *) buffer.pointer;
-
- /* Extract Package Data */
-
- status = acpi_extract_package(package, &format, &data);
- if (status != AE_BUFFER_OVERFLOW) {
- ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error extracting _BIF\n"));
- result = -ENODEV;
- goto end;
- }
-
- data.pointer = kmalloc(data.length, GFP_KERNEL);
- if (!data.pointer) {
- result = -ENOMEM;
- goto end;
- }
- memset(data.pointer, 0, data.length);
-
- status = acpi_extract_package(package, &format, &data);
- if (ACPI_FAILURE(status)) {
- ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error extracting _BIF\n"));
- kfree(data.pointer);
- result = -ENODEV;
- goto end;
- }
-
-end:
- kfree(buffer.pointer);
-
- if (0 == result)
- (*bif) = (struct acpi_battery_info *) data.pointer;
-
- return_VALUE(result);
-}
-
-static int
-acpi_battery_get_status (
- struct acpi_battery *battery,
- struct acpi_battery_status **bst)
-{
- int result = 0;
- acpi_status status = 0;
- acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL};
- acpi_buffer format = {sizeof(ACPI_BATTERY_FORMAT_BST),
- ACPI_BATTERY_FORMAT_BST};
- acpi_buffer data = {0, NULL};
- acpi_object *package = NULL;
-
- ACPI_FUNCTION_TRACE("acpi_battery_get_status");
-
- if (!battery || !bst)
- return_VALUE(-EINVAL);
-
- /* Evalute _BST */
-
- status = acpi_evaluate_object(battery->handle, "_BST", NULL, &buffer);
- if (ACPI_FAILURE(status)) {
- ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _BST\n"));
- return_VALUE(-ENODEV);
- }
-
- package = (acpi_object *) buffer.pointer;
-
- /* Extract Package Data */
-
- status = acpi_extract_package(package, &format, &data);
- if (status != AE_BUFFER_OVERFLOW) {
- ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error extracting _BST\n"));
- result = -ENODEV;
- goto end;
- }
-
- data.pointer = kmalloc(data.length, GFP_KERNEL);
- if (!data.pointer) {
- result = -ENOMEM;
- goto end;
- }
- memset(data.pointer, 0, data.length);
-
- status = acpi_extract_package(package, &format, &data);
- if (ACPI_FAILURE(status)) {
- ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error extracting _BST\n"));
- kfree(data.pointer);
- result = -ENODEV;
- goto end;
- }
-
-end:
- kfree(buffer.pointer);
-
- if (0 == result)
- (*bst) = (struct acpi_battery_status *) data.pointer;
-
- return_VALUE(result);
-}
-
-
-static int
-acpi_battery_set_alarm (
- struct acpi_battery *battery,
- unsigned long alarm)
-{
- acpi_status status = 0;
- acpi_object arg0 = {ACPI_TYPE_INTEGER};
- acpi_object_list arg_list = {1, &arg0};
-
- ACPI_FUNCTION_TRACE("acpi_battery_set_alarm");
-
- if (!battery)
- return_VALUE(-EINVAL);
-
- if (!battery->flags.alarm)
- return_VALUE(-ENODEV);
-
- arg0.integer.value = alarm;
-
- status = acpi_evaluate(battery->handle, "_BTP", &arg_list, NULL);
- if (ACPI_FAILURE(status))
- return_VALUE(-ENODEV);
-
- ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Alarm set to %d\n", (u32) alarm));
-
- battery->alarm = alarm;
-
- return_VALUE(0);
-}
-
-
-static int
-acpi_battery_check (
- struct acpi_battery *battery)
-{
- int result = 0;
- acpi_status status = AE_OK;
- acpi_handle handle = NULL;
- struct acpi_device *device = NULL;
- struct acpi_battery_info *bif = NULL;
-
- ACPI_FUNCTION_TRACE("acpi_battery_check");
-
- if (!battery)
- return_VALUE(-EINVAL);
-
- result = acpi_bus_get_device(battery->handle, &device);
- if (0 != result)
- return_VALUE(result);
-
- result = acpi_bus_get_status(device);
- if (0 != result)
- return_VALUE(result);
-
- /* Insertion? */
-
- if (!battery->flags.present && device->status.battery_present) {
-
- ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Battery inserted\n"));
-
- /* Evalute _BIF to get certain static information */
-
- result = acpi_battery_get_info(battery, &bif);
- if (0 != result)
- return_VALUE(result);
-
- battery->flags.power_unit = bif->power_unit;
- battery->trips.warning = bif->design_capacity_warning;
- battery->trips.low = bif->design_capacity_low;
- kfree(bif);
-
- /* See if alarms are supported, and if so, set default */
-
- status = acpi_get_handle(battery->handle, "_BTP", &handle);
- if (ACPI_SUCCESS(status)) {
- battery->flags.alarm = 1;
- acpi_battery_set_alarm(battery, battery->trips.warning);
- }
- }
-
- /* Removal? */
-
- else if (battery->flags.present && !device->status.battery_present) {
- ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Battery removed\n"));
- }
-
- battery->flags.present = device->status.battery_present;
-
- return_VALUE(result);
-}
-
-
-/* --------------------------------------------------------------------------
- FS Interface (/proc)
- -------------------------------------------------------------------------- */
-
-#include
-#include
-
-struct proc_dir_entry *acpi_battery_dir = NULL;
-
-static int
-acpi_battery_read_info (
- char *page,
- char **start,
- off_t off,
- int count,
- int *eof,
- void *data)
-{
- int result = 0;
- struct acpi_battery *battery = (struct acpi_battery *) data;
- struct acpi_battery_info *bif = NULL;
- char *units = "?";
- char *p = page;
- int len = 0;
-
- ACPI_FUNCTION_TRACE("acpi_battery_read_info");
-
- if (!battery)
- goto end;
-
- if (battery->flags.present)
- p += sprintf(p, "present: yes\n");
- else {
- p += sprintf(p, "present: no\n");
- goto end;
- }
-
- /* Battery Info (_BIF) */
-
- result = acpi_battery_get_info(battery, &bif);
- if ((0 != result) || !bif) {
- p += sprintf(p, "ERROR: Unable to read battery information\n");
- goto end;
- }
-
- units = bif->power_unit ? ACPI_BATTERY_UNITS_AMPS : ACPI_BATTERY_UNITS_WATTS;
-
- if (bif->design_capacity == ACPI_BATTERY_VALUE_UNKNOWN)
- p += sprintf(p, "design capacity: unknown\n");
- else
- p += sprintf(p, "design capacity: %d %sh\n",
- (u32) bif->design_capacity, units);
-
- if (bif->last_full_capacity == ACPI_BATTERY_VALUE_UNKNOWN)
- p += sprintf(p, "last full capacity: unknown\n");
- else
- p += sprintf(p, "last full capacity: %d %sh\n",
- (u32) bif->last_full_capacity, units);
-
- switch ((u32) bif->battery_technology) {
- case 0:
- p += sprintf(p, "battery technology: non-rechargeable\n");
- break;
- case 1:
- p += sprintf(p, "battery technology: rechargeable\n");
- break;
- default:
- p += sprintf(p, "battery technology: unknown\n");
- break;
- }
-
- if (bif->design_voltage == ACPI_BATTERY_VALUE_UNKNOWN)
- p += sprintf(p, "design voltage: unknown\n");
- else
- p += sprintf(p, "design voltage: %d mV\n",
- (u32) bif->design_voltage);
-
- p += sprintf(p, "design capacity warning: %d %sh\n",
- (u32) bif->design_capacity_warning, units);
- p += sprintf(p, "design capacity low: %d %sh\n",
- (u32) bif->design_capacity_low, units);
- p += sprintf(p, "capacity granularity 1: %d %sh\n",
- (u32) bif->battery_capacity_granularity_1, units);
- p += sprintf(p, "capacity granularity 2: %d %sh\n",
- (u32) bif->battery_capacity_granularity_2, units);
- p += sprintf(p, "model number: %s\n",
- bif->model_number);
- p += sprintf(p, "serial number: %s\n",
- bif->serial_number);
- p += sprintf(p, "battery type: %s\n",
- bif->battery_type);
- p += sprintf(p, "OEM info: %s\n",
- bif->oem_info);
-
-end:
- kfree(bif);
-
- len = (p - page);
- if (len <= off+count) *eof = 1;
- *start = page + off;
- len -= off;
- if (len>count) len = count;
- if (len<0) len = 0;
-
- return_VALUE(len);
-}
-
-
-static int
-acpi_battery_read_state (
- char *page,
- char **start,
- off_t off,
- int count,
- int *eof,
- void *data)
-{
- int result = 0;
- struct acpi_battery *battery = (struct acpi_battery *) data;
- struct acpi_battery_status *bst = NULL;
- char *units = "?";
- char *p = page;
- int len = 0;
-
- ACPI_FUNCTION_TRACE("acpi_battery_read_state");
-
- if (!battery)
- goto end;
-
- if (battery->flags.present)
- p += sprintf(p, "present: yes\n");
- else {
- p += sprintf(p, "present: no\n");
- goto end;
- }
-
- /* Battery Units */
-
- units = battery->flags.power_unit ? ACPI_BATTERY_UNITS_AMPS : ACPI_BATTERY_UNITS_WATTS;
-
- /* Battery Status (_BST) */
-
- result = acpi_battery_get_status(battery, &bst);
- if ((0 != result) || !bst) {
- p += sprintf(p, "ERROR: Unable to read battery status\n");
- goto end;
- }
-
- if (!(bst->state & 0x04))
- p += sprintf(p, "capacity state: ok\n");
- else
- p += sprintf(p, "capacity state: critical\n");
-
- if ((bst->state & 0x01) && (bst->state & 0x02))
- p += sprintf(p, "charging state: charging/discharging\n");
- else if (bst->state & 0x01)
- p += sprintf(p, "charging state: discharging\n");
- else if (bst->state & 0x02)
- p += sprintf(p, "charging state: charging\n");
- else
- p += sprintf(p, "charging state: unknown\n");
-
- if (bst->present_rate == ACPI_BATTERY_VALUE_UNKNOWN)
- p += sprintf(p, "present rate: unknown\n");
- else
- p += sprintf(p, "present rate: %d %s\n",
- (u32) bst->present_rate, units);
-
- if (bst->remaining_capacity == ACPI_BATTERY_VALUE_UNKNOWN)
- p += sprintf(p, "remaining capacity: unknown\n");
- else
- p += sprintf(p, "remaining capacity: %d %sh\n",
- (u32) bst->remaining_capacity, units);
-
- if (bst->present_voltage == ACPI_BATTERY_VALUE_UNKNOWN)
- p += sprintf(p, "present voltage: unknown\n");
- else
- p += sprintf(p, "present voltage: %d mV\n",
- (u32) bst->present_voltage);
-
-end:
- kfree(bst);
-
- len = (p - page);
- if (len <= off+count) *eof = 1;
- *start = page + off;
- len -= off;
- if (len>count) len = count;
- if (len<0) len = 0;
-
- return_VALUE(len);
-}
-
-
-static int
-acpi_battery_read_alarm (
- char *page,
- char **start,
- off_t off,
- int count,
- int *eof,
- void *data)
-{
- struct acpi_battery *battery = (struct acpi_battery *) data;
- char *units = "?";
- char *p = page;
- int len = 0;
-
- ACPI_FUNCTION_TRACE("acpi_battery_read_alarm");
-
- if (!battery)
- goto end;
-
- if (!battery->flags.present) {
- p += sprintf(p, "present: no\n");
- goto end;
- }
-
- /* Battery Units */
-
- units = battery->flags.power_unit ? ACPI_BATTERY_UNITS_AMPS : ACPI_BATTERY_UNITS_WATTS;
-
- /* Battery Alarm */
-
- p += sprintf(p, "alarm: ");
- if (!battery->alarm)
- p += sprintf(p, "unsupported\n");
- else
- p += sprintf(p, "%d %sh\n", (u32) battery->alarm, units);
-
-end:
- len = (p - page);
- if (len <= off+count) *eof = 1;
- *start = page + off;
- len -= off;
- if (len>count) len = count;
- if (len<0) len = 0;
-
- return_VALUE(len);
-}
-
-
-static int
-acpi_battery_write_alarm (
- struct file *file,
- const char *buffer,
- unsigned long count,
- void *data)
-{
- int result = 0;
- struct acpi_battery *battery = (struct acpi_battery *) data;
- char alarm_string[12] = {'\0'};
-
- ACPI_FUNCTION_TRACE("acpi_battery_write_alarm");
-
- if (!battery || (count > sizeof(alarm_string) - 1))
- return_VALUE(-EINVAL);
-
- if (!battery->flags.present)
- return_VALUE(-ENODEV);
-
- if (copy_from_user(alarm_string, buffer, count))
- return_VALUE(-EFAULT);
-
- alarm_string[count] = '\0';
-
- result = acpi_battery_set_alarm(battery,
- simple_strtoul(alarm_string, NULL, 0));
- if (0 != result)
- return_VALUE(result);
-
- return_VALUE(count);
-}
-
-
-static int
-acpi_battery_add_fs (
- struct acpi_device *device)
-{
- struct proc_dir_entry *entry = NULL;
-
- ACPI_FUNCTION_TRACE("acpi_battery_add_fs");
-
- if (!acpi_battery_dir) {
- acpi_battery_dir = proc_mkdir(ACPI_BATTERY_CLASS, acpi_root_dir);
- if (!acpi_battery_dir)
- return_VALUE(-ENODEV);
- }
-
- if (!acpi_device_dir(device)) {
- acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
- acpi_battery_dir);
- if (!acpi_device_dir(device))
- return_VALUE(-ENODEV);
- }
-
- /* 'info' [R] */
- entry = create_proc_entry(ACPI_BATTERY_FILE_INFO,
- S_IRUGO, acpi_device_dir(device));
- if (!entry)
- ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
- "Unable to create '%s' fs entry\n",
- ACPI_BATTERY_FILE_INFO));
- else {
- entry->read_proc = acpi_battery_read_info;
- entry->data = acpi_driver_data(device);
- }
-
- /* 'status' [R] */
- entry = create_proc_entry(ACPI_BATTERY_FILE_STATUS,
- S_IRUGO, acpi_device_dir(device));
- if (!entry)
- ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
- "Unable to create '%s' fs entry\n",
- ACPI_BATTERY_FILE_STATUS));
- else {
- entry->read_proc = acpi_battery_read_state;
- entry->data = acpi_driver_data(device);
- }
-
- /* 'alarm' [R/W] */
- entry = create_proc_entry(ACPI_BATTERY_FILE_ALARM,
- S_IFREG|S_IRUGO|S_IWUSR, acpi_device_dir(device));
- if (!entry)
- ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
- "Unable to create '%s' fs entry\n",
- ACPI_BATTERY_FILE_ALARM));
- else {
- entry->read_proc = acpi_battery_read_alarm;
- entry->write_proc = acpi_battery_write_alarm;
- entry->data = acpi_driver_data(device);
- }
-
- return_VALUE(0);
-}
-
-
-static int
-acpi_battery_remove_fs (
- struct acpi_device *device)
-{
- ACPI_FUNCTION_TRACE("acpi_battery_remove_fs");
-
- if (!acpi_battery_dir)
- return_VALUE(-ENODEV);
-
- if (acpi_device_dir(device))
- remove_proc_entry(acpi_device_bid(device), acpi_battery_dir);
-
- return_VALUE(0);
-}
-
-
-/* --------------------------------------------------------------------------
- Driver Interface
- -------------------------------------------------------------------------- */
-
-static void
-acpi_battery_notify (
- acpi_handle handle,
- u32 event,
- void *data)
-{
- struct acpi_battery *battery = (struct acpi_battery *) data;
- struct acpi_device *device = NULL;
-
- ACPI_FUNCTION_TRACE("acpi_battery_notify");
-
- if (!battery)
- return_VOID;
-
- if (0 != acpi_bus_get_device(handle, &device))
- return_VOID;
-
- switch (event) {
- case ACPI_BATTERY_NOTIFY_STATUS:
- case ACPI_BATTERY_NOTIFY_INFO:
- acpi_battery_check(battery);
- acpi_bus_generate_event(device, event, battery->flags.present);
- break;
- default:
- ACPI_DEBUG_PRINT((ACPI_DB_INFO,
- "Unsupported event [0x%x]\n", event));
- break;
- }
-
- return_VOID;
-}
-
-
-static int
-acpi_battery_add (
- struct acpi_device *device)
-{
- int result = 0;
- acpi_status status = 0;
- struct acpi_battery *battery = NULL;
-
- ACPI_FUNCTION_TRACE("acpi_battery_add");
-
- if (!device)
- return_VALUE(-EINVAL);
-
- battery = kmalloc(sizeof(struct acpi_battery), GFP_KERNEL);
- if (!battery)
- return_VALUE(-ENOMEM);
- memset(battery, 0, sizeof(struct acpi_battery));
-
- battery->handle = device->handle;
- sprintf(acpi_device_name(device), "%s", ACPI_BATTERY_DEVICE_NAME);
- sprintf(acpi_device_class(device), "%s", ACPI_BATTERY_CLASS);
- acpi_driver_data(device) = battery;
-
- result = acpi_battery_check(battery);
- if (0 != result)
- goto end;
-
- result = acpi_battery_add_fs(device);
- if (0 != result)
- goto end;
-
- status = acpi_install_notify_handler(battery->handle,
- ACPI_DEVICE_NOTIFY, acpi_battery_notify, battery);
- if (ACPI_FAILURE(status)) {
- ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
- "Error installing notify handler\n"));
- result = -ENODEV;
- goto end;
- }
-
- printk(KERN_INFO PREFIX "%s Slot [%s] (battery %s)\n",
- ACPI_BATTERY_DEVICE_NAME, acpi_device_bid(device),
- device->status.battery_present?"present":"absent");
-
-end:
- if (0 != result) {
- acpi_battery_remove_fs(device);
- kfree(battery);
- }
-
- return_VALUE(result);
-}
-
-
-static int
-acpi_battery_remove (
- struct acpi_device *device,
- int type)
-{
- acpi_status status = 0;
- struct acpi_battery *battery = NULL;
-
- ACPI_FUNCTION_TRACE("acpi_battery_remove");
-
- if (!device || !acpi_driver_data(device))
- return_VALUE(-EINVAL);
-
- battery = (struct acpi_battery *) acpi_driver_data(device);
-
- status = acpi_remove_notify_handler(battery->handle,
- ACPI_DEVICE_NOTIFY, acpi_battery_notify);
- if (ACPI_FAILURE(status))
- ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
- "Error removing notify handler\n"));
-
- acpi_battery_remove_fs(device);
-
- kfree(battery);
-
- return_VALUE(0);
-}
-
-
-static int __init
-acpi_battery_init (void)
-{
- int result = 0;
-
- ACPI_FUNCTION_TRACE("acpi_battery_init");
-
- result = acpi_bus_register_driver(&acpi_battery_driver);
- if (0 > result) {
- remove_proc_entry(ACPI_BATTERY_CLASS, acpi_root_dir);
- return_VALUE(-ENODEV);
- }
-
- return_VALUE(0);
-}
-
-
-static void __exit
-acpi_battery_exit (void)
-{
- int result = 0;
-
- ACPI_FUNCTION_TRACE("acpi_battery_exit");
-
- result = acpi_bus_unregister_driver(&acpi_battery_driver);
- if (0 == result)
- remove_proc_entry(ACPI_BATTERY_CLASS, acpi_root_dir);
-
- return_VOID;
-}
-
-
-module_init(acpi_battery_init);
-module_exit(acpi_battery_exit);
diff -Nru a/drivers/acpi/bus.c b/drivers/acpi/bus.c
--- a/drivers/acpi/bus.c Wed Oct 8 09:05:45 2003
+++ /dev/null Wed Dec 31 16:00:00 1969
@@ -1,2197 +0,0 @@
-/*
- * acpi_bus.c - ACPI Bus Driver ($Revision: 72 $)
- *
- * Copyright (C) 2001, 2002 Paul Diefenbaugh
- *
- * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at
- * your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- *
- * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- */
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include "acpi_bus.h"
-#include "acpi_drivers.h"
-#include "include/acinterp.h" /* for acpi_ex_eisa_id_to_string() */
-
-
-#define _COMPONENT ACPI_BUS_COMPONENT
-ACPI_MODULE_NAME ("acpi_bus")
-
-MODULE_AUTHOR("Paul Diefenbaugh");
-MODULE_DESCRIPTION(ACPI_BUS_DRIVER_NAME);
-MODULE_LICENSE("GPL");
-
-#define PREFIX "ACPI: "
-
-FADT_DESCRIPTOR acpi_fadt;
-static u8 acpi_disabled;
-struct acpi_device *acpi_root;
-struct proc_dir_entry *acpi_root_dir;
-
-#define STRUCT_TO_INT(s) (*((int*)&s))
-
-/*
- * POLICY: If *anything* doesn't work, put it on the blacklist.
- * If they are critical errors, mark it critical, and abort driver load.
- */
-static struct acpi_blacklist_item acpi_blacklist[] __initdata =
-{
- /* Portege 7020, BIOS 8.10 */
- {"TOSHIB", "7020CT ", 0x19991112, ACPI_TABLE_DSDT, all_versions, "Implicit Return", 0},
- /* Portege 4030 */
- {"TOSHIB", "4030 ", 0x19991112, ACPI_TABLE_DSDT, all_versions, "Implicit Return", 0},
- /* Portege 310/320, BIOS 7.1 */
- {"TOSHIB", "310 ", 0x19990511, ACPI_TABLE_DSDT, all_versions, "Implicit Return", 0},
- /* Seattle 2, old bios rev. */
- {"INTEL ", "440BX ", 0x00001000, ACPI_TABLE_DSDT, less_than_or_equal, "Field beyond end of region", 0},
- /* ASUS K7M */
- {"ASUS ", "K7M ", 0x00001000, ACPI_TABLE_DSDT, less_than_or_equal, "Field beyond end of region", 0},
- /* Intel 810 Motherboard? */
- {"MNTRAL", "MO81010A", 0x00000012, ACPI_TABLE_DSDT, less_than_or_equal, "Field beyond end of region", 0},
- /* Compaq Presario 1700 */
- {"PTLTD ", " DSDT ", 0x06040000, ACPI_TABLE_DSDT, less_than_or_equal, "Multiple problems", 1},
- /* Sony FX120, FX140, FX150? */
- {"SONY ", "U0 ", 0x20010313, ACPI_TABLE_DSDT, less_than_or_equal, "ACPI driver problem", 1},
- /* Compaq Presario 800, Insyde BIOS */
- {"INT440", "SYSFexxx", 0x00001001, ACPI_TABLE_DSDT, less_than_or_equal, "Does not use _REG to protect EC OpRegions", 1},
- /* IBM 600E - _ADR should return 7, but it returns 1 */
- {"IBM ", "TP600E ", 0x00000105, ACPI_TABLE_DSDT, less_than_or_equal, "Incorrect _ADR", 1},
- {""}
-};
-
-
-/* --------------------------------------------------------------------------
- Linux Driver Model (LDM) Support
- -------------------------------------------------------------------------- */
-
-#ifdef CONFIG_LDM
-
-static int acpi_device_probe(struct device *dev);
-static int acpi_device_remove(struct device *dev, u32 flags);
-static int acpi_device_suspend(struct device *dev, u32 state, u32 stage);
-static int acpi_device_resume(struct device *dev, u32 stage);
-
-static struct device_driver acpi_bus_driver = {
- probe: acpi_device_probe,
- remove: acpi_device_remove,
- suspend: acpi_device_suspend,
- resume: acpi_device_resume,
-};
-
-
-static int
-acpi_device_probe (
- struct device *dev)
-{
- ACPI_FUNCTION_TRACE("acpi_device_probe");
-
- if (!dev)
- return_VALUE(-EINVAL);
-
- /* TBD */
-
- return_VALUE(0);
-}
-
-
-static int
-acpi_device_remove (
- struct device *dev,
- u32 flags)
-{
- ACPI_FUNCTION_TRACE("acpi_device_remove");
-
- if (!dev)
- return_VALUE(-EINVAL);
-
- /* TBD */
-
- return_VALUE(0);
-}
-
-
-static int
-acpi_device_suspend (
- struct device *dev,
- u32 state,
- u32 stage)
-{
- ACPI_FUNCTION_TRACE("acpi_device_suspend");
-
- if (!dev)
- return_VALUE(-EINVAL);
-
- /* TBD */
-
- return_VALUE(0);
-}
-
-
-static int
-acpi_device_resume (
- struct device *dev,
- u32 stage)
-{
- ACPI_FUNCTION_TRACE("acpi_device_resume");
-
- if (!dev)
- return_VALUE(-EINVAL);
-
- /* TBD */
-
- return_VALUE(0);
-}
-
-#if 0 /* not used ATM */
-static int
-acpi_platform_add (
- struct device *dev)
-{
- ACPI_FUNCTION_TRACE("acpi_platform_add");
-
- if (!dev)
- return -EINVAL;
-
- ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device %s (%s) added\n",
- dev->name, dev->bus_id));
-
- /* TBD */
-
- return_VALUE(0);
-}
-
-
-static int
-acpi_platform_remove (
- struct device *dev)
-{
- ACPI_FUNCTION_TRACE("acpi_platform_add");
-
- if (!dev)
- return -EINVAL;
-
- ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device %s (%s) removed\n",
- dev->name, dev->bus_id));
-
- /* TBD */
-
- return_VALUE(0);
-}
-#endif /* unused */
-
-
-#endif /*CONFIG_LDM*/
-
-
-static int
-acpi_device_register (
- struct acpi_device *device,
- struct acpi_device *parent)
-{
- int result = 0;
-
- ACPI_FUNCTION_TRACE("acpi_device_register");
-
- if (!device)
- return_VALUE(-EINVAL);
-
-#ifdef CONFIG_LDM
- sprintf(device->dev.name, "ACPI device %s:%s",
- device->pnp.hardware_id, device->pnp.unique_id);
- strncpy(device->dev.bus_id, device->pnp.bus_id, sizeof(acpi_bus_id));
- if (parent)
- device->dev.parent = &parent->dev;
- device->dev.driver = &acpi_bus_driver;
-
- result = device_register(&device->dev);
-#endif /*CONFIG_LDM*/
-
- return_VALUE(result);
-}
-
-
-static int
-acpi_device_unregister (
- struct acpi_device *device)
-{
- ACPI_FUNCTION_TRACE("acpi_device_unregister");
-
- if (!device)
- return_VALUE(-EINVAL);
-
-#ifdef CONFIG_LDM
- put_device(&device->dev);
-#endif /*CONFIG_LDM*/
-
- return_VALUE(0);
-}
-
-
-/* --------------------------------------------------------------------------
- Device Management
- -------------------------------------------------------------------------- */
-
-static void
-acpi_bus_data_handler (
- acpi_handle handle,
- u32 function,
- void *context)
-{
- ACPI_FUNCTION_TRACE("acpi_bus_data_handler");
-
- /* TBD */
-
- return_VOID;
-}
-
-
-int
-acpi_bus_get_device (
- acpi_handle handle,
- struct acpi_device **device)
-{
- acpi_status status = AE_OK;
-
- ACPI_FUNCTION_TRACE("acpi_bus_get_device");
-
- if (!device)
- return_VALUE(-EINVAL);
-
- /* TBD: Support fixed-feature devices */
-
- status = acpi_get_data(handle, acpi_bus_data_handler, (void**) device);
- if (ACPI_FAILURE(status) || !*device) {
- ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Error getting context for object [%p]\n",
- handle));
- return_VALUE(-ENODEV);
- }
-
- return_VALUE(0);
-}
-
-int
-acpi_bus_get_status (
- struct acpi_device *device)
-{
- acpi_status status = AE_OK;
- unsigned long sta = 0;
-
- ACPI_FUNCTION_TRACE("acpi_bus_get_status");
-
- if (!device)
- return_VALUE(-EINVAL);
-
- /*
- * Evaluate _STA if present.
- */
- if (device->flags.dynamic_status) {
- status = acpi_evaluate_integer(device->handle, "_STA", NULL, &sta);
- if (ACPI_FAILURE(status))
- return_VALUE(-ENODEV);
- STRUCT_TO_INT(device->status) = (int) sta;
- }
-
- /*
- * Otherwise we assume the status of our parent (unless we don't
- * have one, in which case status is implied).
- */
- else if (device->parent)
- device->status = device->parent->status;
- else
- STRUCT_TO_INT(device->status) = 0x0F;
-
- ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] status [%08x]\n",
- device->pnp.bus_id, (u32) STRUCT_TO_INT(device->status)));
-
- return_VALUE(0);
-}
-
-
-/*
-static int
-acpi_bus_create_device_fs (struct device *device)
-{
- ACPI_FUNCTION_TRACE("acpi_bus_create_device_fs");
-
- if (!device)
- return_VALUE(-EINVAL);
-
- if (device->dir.entry)
- return_VALUE(-EEXIST);
-
- if (!device->parent)
- device->dir.entry = proc_mkdir(device->pnp.bus_id, NULL);
- else
- device->dir.entry = proc_mkdir(device->pnp.bus_id,
- device->parent->fs.entry);
-
- if (!device->dir.entry) {
- printk(KERN_ERR PREFIX "Unable to create fs entry '%s'\n",
- device->pnp.bus_id);
- return_VALUE(-ENODEV);
- }
-
- return_VALUE(0);
-}
-
-
-static int
-acpi_bus_remove_device_fs (struct device *device)
-{
- ACPI_FUNCTION_TRACE("acpi_bus_create_device_fs");
-
- if (!device)
- return_VALUE(-EINVAL);
-
- if (!device->dir.entry)
- return_VALUE(-ENODEV);
-
- if (!device->parent)
- remove_proc_entry(device->pnp_bus_id, NULL);
- else
- remove_proc_entry(device->pnp.bus_id, device->parent->fs.entry);
-
- device->dir.entry = NULL;
-
- return_VALUE(0);
-}
-*/
-
-
-/* --------------------------------------------------------------------------
- Power Management
- -------------------------------------------------------------------------- */
-
-int
-acpi_bus_get_power (
- acpi_handle handle,
- int *state)
-{
- int result = 0;
- acpi_status status = 0;
- struct acpi_device *device = NULL;
- unsigned long psc = 0;
-
- ACPI_FUNCTION_TRACE("acpi_bus_get_power");
-
- result = acpi_bus_get_device(handle, &device);
- if (0 != result)
- return_VALUE(result);
-
- *state = ACPI_STATE_UNKNOWN;
-
- if (!device->flags.power_manageable) {
- /* TBD: Non-recursive algorithm for walking up hierarchy */
- if (device->parent)
- *state = device->parent->power.state;
- else
- *state = ACPI_STATE_D0;
- }
- else {
- /*
- * Get the device's power state either directly (via _PSC) or
- * indirectly (via power resources).
- */
- if (device->power.flags.explicit_get) {
- status = acpi_evaluate_integer(device->handle, "_PSC",
- NULL, &psc);
- if (ACPI_FAILURE(status))
- return_VALUE(-ENODEV);
- device->power.state = (int) psc;
- }
- else if (device->power.flags.power_resources) {
- result = acpi_power_get_inferred_state(device);
- if (0 != result)
- return_VALUE(result);
- }
-
- *state = device->power.state;
- }
-
- ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] power state is D%d\n",
- device->pnp.bus_id, device->power.state));
-
- return_VALUE(0);
-}
-
-
-int
-acpi_bus_set_power (
- acpi_handle handle,
- int state)
-{
- int result = 0;
- acpi_status status = AE_OK;
- struct acpi_device *device = NULL;
- char object_name[5] = {'_','P','S','0'+state,'\0'};
-
- ACPI_FUNCTION_TRACE("acpi_bus_set_power");
-
- result = acpi_bus_get_device(handle, &device);
- if (0 != result)
- return_VALUE(result);
-
- if ((state < ACPI_STATE_D0) || (state > ACPI_STATE_D3))
- return_VALUE(-EINVAL);
-
- /* Make sure this is a valid target state */
-
- if (!device->flags.power_manageable) {
- ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Device is not power manageable\n"));
- return_VALUE(-ENODEV);
- }
- if (state == device->power.state) {
- ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device is already at D%d\n", state));
- return_VALUE(0);
- }
- if (!device->power.states[state].flags.valid) {
- ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Device does not support D%d\n", state));
- return_VALUE(-ENODEV);
- }
- if (device->parent && (state < device->parent->power.state)) {
- ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Cannot set device to a higher-powered state than parent\n"));
- return_VALUE(-ENODEV);
- }
-
- /*
- * Transition Power
- * ----------------
- * On transitions to a high-powered state we first apply power (via
- * power resources) then evalute _PSx. Conversly for transitions to
- * a lower-powered state.
- */
- if (state < device->power.state) {
- if (device->power.flags.power_resources) {
- result = acpi_power_transition(device, state);
- if (0 != result)
- goto end;
- }
- if (device->power.states[state].flags.explicit_set) {
- status = acpi_evaluate_object(device->handle,
- object_name, NULL, NULL);
- if (ACPI_FAILURE(status)) {
- result = -ENODEV;
- goto end;
- }
- }
- }
- else {
- if (device->power.states[state].flags.explicit_set) {
- status = acpi_evaluate_object(device->handle,
- object_name, NULL, NULL);
- if (ACPI_FAILURE(status)) {
- result = -ENODEV;
- goto end;
- }
- }
- if (device->power.flags.power_resources) {
- result = acpi_power_transition(device, state);
- if (0 != result)
- goto end;
- }
- }
-
-end:
- if (0 != result)
- ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Error transitioning device [%s] to D%d\n",
- device->pnp.bus_id, state));
- else
- ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] transitioned to D%d\n",
- device->pnp.bus_id, state));
-
- return_VALUE(result);
-}
-
-
-static int
-acpi_bus_get_power_flags (
- struct acpi_device *device)
-{
- acpi_status status = 0;
- acpi_handle handle = 0;
- u32 i = 0;
-
- ACPI_FUNCTION_TRACE("acpi_bus_get_power_flags");
-
- if (!device)
- return -ENODEV;
-
- /*
- * Power Management Flags
- */
- status = acpi_get_handle(device->handle, "_PSC", &handle);
- if (ACPI_SUCCESS(status))
- device->power.flags.explicit_get = 1;
- status = acpi_get_handle(device->handle, "_IRC", &handle);
- if (ACPI_SUCCESS(status))
- device->power.flags.inrush_current = 1;
- status = acpi_get_handle(device->handle, "_PRW", &handle);
- if (ACPI_SUCCESS(status))
- device->power.flags.wake_capable = 1;
-
- /*
- * Enumerate supported power management states
- */
- for (i = ACPI_STATE_D0; i <= ACPI_STATE_D3; i++) {
- struct acpi_device_power_state *ps = &device->power.states[i];
- char object_name[5] = {'_','P','R','0'+i,'\0'};
-
- /* Evaluate "_PRx" to se if power resources are referenced */
- acpi_evaluate_reference(device->handle, object_name, NULL,
- &ps->resources);
- if (ps->resources.count) {
- device->power.flags.power_resources = 1;
- ps->flags.valid = 1;
- }
-
- /* Evaluate "_PSx" to see if we can do explicit sets */
- object_name[2] = 'S';
- status = acpi_get_handle(device->handle, object_name, &handle);
- if (ACPI_SUCCESS(status)) {
- ps->flags.explicit_set = 1;
- ps->flags.valid = 1;
- }
-
- /* State is valid if we have some power control */
- if (ps->resources.count || ps->flags.explicit_set)
- ps->flags.valid = 1;
-
- ps->power = -1; /* Unknown - driver assigned */
- ps->latency = -1; /* Unknown - driver assigned */
- }
-
- /* Set defaults for D0 and D3 states (always valid) */
- device->power.states[ACPI_STATE_D0].flags.valid = 1;
- device->power.states[ACPI_STATE_D0].power = 100;
- device->power.states[ACPI_STATE_D3].flags.valid = 1;
- device->power.states[ACPI_STATE_D3].power = 0;
-
- /*
- * System Power States
- * -------------------
- */
- /* TBD: S1-S4 power state support and resource requirements. */
- /*
- for (i=ACPI_STATE_S1; ihandle, name, NULL,
- &state);
- if (ACPI_FAILURE(status))
- continue;
- }
- */
-
- /* TBD: System wake support and resource requirements. */
-
- device->power.state = ACPI_STATE_UNKNOWN;
-
- return 0;
-}
-
-
-/* --------------------------------------------------------------------------
- Performance Management
- -------------------------------------------------------------------------- */
-
-static int
-acpi_bus_get_perf_flags (
- struct acpi_device *device)
-{
- ACPI_FUNCTION_TRACE("acpi_bus_get_perf_flags");
-
- if (!device)
- return -ENODEV;
-
- device->performance.state = ACPI_STATE_UNKNOWN;
-
- return 0;
-}
-
-
-/* --------------------------------------------------------------------------
- Event Management
- -------------------------------------------------------------------------- */
-
-static spinlock_t acpi_bus_event_lock = SPIN_LOCK_UNLOCKED;
-
-LIST_HEAD(acpi_bus_event_list);
-DECLARE_WAIT_QUEUE_HEAD(acpi_bus_event_queue);
-
-extern int event_is_open;
-
-int
-acpi_bus_generate_event (
- struct acpi_device *device,
- u8 type,
- int data)
-{
- struct acpi_bus_event *event = NULL;
- u32 flags = 0;
-
- ACPI_FUNCTION_TRACE("acpi_bus_generate_event");
-
- if (!device)
- return_VALUE(-EINVAL);
-
- /* drop event on the floor if no one's listening */
- if (!event_is_open)
- return_VALUE(0);
-
- event = kmalloc(sizeof(struct acpi_bus_event), GFP_KERNEL);
- if (!event)
- return_VALUE(-ENOMEM);
-
- sprintf(event->device_class, "%s", device->pnp.device_class);
- sprintf(event->bus_id, "%s", device->pnp.bus_id);
- event->type = type;
- event->data = data;
-
- spin_lock_irqsave(&acpi_bus_event_lock, flags);
- list_add_tail(&event->node, &acpi_bus_event_list);
- spin_unlock_irqrestore(&acpi_bus_event_lock, flags);
-
- wake_up_interruptible(&acpi_bus_event_queue);
-
- return_VALUE(0);
-}
-
-int
-acpi_bus_receive_event (
- struct acpi_bus_event *event)
-{
- u32 flags = 0;
- struct acpi_bus_event *entry = NULL;
-
- DECLARE_WAITQUEUE(wait, current);
-
- ACPI_FUNCTION_TRACE("acpi_bus_receive_event");
-
- if (!event)
- return -EINVAL;
-
- if (list_empty(&acpi_bus_event_list)) {
-
- set_current_state(TASK_INTERRUPTIBLE);
- add_wait_queue(&acpi_bus_event_queue, &wait);
-
- if (list_empty(&acpi_bus_event_list))
- schedule();
-
- remove_wait_queue(&acpi_bus_event_queue, &wait);
- set_current_state(TASK_RUNNING);
-
- if (signal_pending(current))
- return_VALUE(-ERESTARTSYS);
- }
-
- spin_lock_irqsave(&acpi_bus_event_lock, flags);
- entry = list_entry(acpi_bus_event_list.next, struct acpi_bus_event, node);
- if (entry)
- list_del(&entry->node);
- spin_unlock_irqrestore(&acpi_bus_event_lock, flags);
-
- if (!entry)
- return_VALUE(-ENODEV);
-
- memcpy(event, entry, sizeof(struct acpi_bus_event));
-
- kfree(entry);
-
- return_VALUE(0);
-}
-
-
-/* --------------------------------------------------------------------------
- Namespace Management
- -------------------------------------------------------------------------- */
-
-#define WALK_UP 0
-#define WALK_DOWN 1
-
-typedef int (*acpi_bus_walk_callback)(struct acpi_device*, int, void*);
-
-#define HAS_CHILDREN(d) ((d)->children.next != &((d)->children))
-#define HAS_SIBLINGS(d) (((d)->parent) && ((d)->node.next != &(d)->parent->children))
-#define NODE_TO_DEVICE(n) (list_entry(n, struct acpi_device, node))
-
-
-/**
- * acpi_bus_walk
- * -------------
- * Used to walk the ACPI Bus's device namespace. Can walk down (depth-first)
- * or up. Able to parse starting at any node in the namespace. Note that a
- * callback return value of -ELOOP will terminate the walk.
- *
- * @start: starting point
- * callback: function to call for every device encountered while parsing
- * direction: direction to parse (up or down)
- * @data: context for this search operation
- */
-static int
-acpi_bus_walk (
- struct acpi_device *start,
- acpi_bus_walk_callback callback,
- int direction,
- void *data)
-{
- int result = 0;
- int level = 0;
- struct acpi_device *device = NULL;
-
- if (!start || !callback)
- return -EINVAL;
-
- device = start;
-
- /*
- * Parse Namespace
- * ---------------
- * Parse a given subtree (specified by start) in the given direction.
- * Walking 'up' simply means that we execute the callback on leaf
- * devices prior to their parents (useful for things like removing
- * or powering down a subtree).
- */
-
- while (device) {
-
- if (direction == WALK_DOWN)
- if (-ELOOP == callback(device, level, data))
- break;
-
- /* Depth First */
-
- if (HAS_CHILDREN(device)) {
- device = NODE_TO_DEVICE(device->children.next);
- ++level;
- continue;
- }
-
- if (direction == WALK_UP)
- if (-ELOOP == callback(device, level, data))
- break;
-
- /* Now Breadth */
-
- if (HAS_SIBLINGS(device)) {
- device = NODE_TO_DEVICE(device->node.next);
- continue;
- }
-
- /* Scope Exhausted - Find Next */
-
- while ((device = device->parent)) {
- --level;
- if (HAS_SIBLINGS(device)) {
- device = NODE_TO_DEVICE(device->node.next);
- break;
- }
- }
- }
-
- if ((direction == WALK_UP) && (result == 0))
- callback(start, level, data);
-
- return result;
-}
-
-
-/* --------------------------------------------------------------------------
- Notification Handling
- -------------------------------------------------------------------------- */
-
-static int
-acpi_bus_check_device (
- struct acpi_device *device,
- int *status_changed)
-{
- acpi_status status = 0;
- struct acpi_device_status old_status;
-
- ACPI_FUNCTION_TRACE("acpi_bus_check_device");
-
- if (!device)
- return_VALUE(-EINVAL);
-
- if (status_changed)
- *status_changed = 0;
-
- old_status = device->status;
-
- /*
- * Make sure this device's parent is present before we go about
- * messing with the device.
- */
- if (device->parent && !device->parent->status.present) {
- device->status = device->parent->status;
- if (STRUCT_TO_INT(old_status) != STRUCT_TO_INT(device->status)) {
- if (status_changed)
- *status_changed = 1;
- }
- return_VALUE(0);
- }
-
- status = acpi_bus_get_status(device);
- if (ACPI_FAILURE(status))
- return_VALUE(-ENODEV);
-
- if (STRUCT_TO_INT(old_status) == STRUCT_TO_INT(device->status))
- return_VALUE(0);
-
- if (status_changed)
- *status_changed = 1;
-
- /*
- * Device Insertion/Removal
- */
- if ((device->status.present) && !(old_status.present)) {
- ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device insertion detected\n"));
- /* TBD: Handle device insertion */
- }
- else if (!(device->status.present) && (old_status.present)) {
- ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device removal detected\n"));
- /* TBD: Handle device removal */
- }
-
- return_VALUE(0);
-}
-
-
-static int
-acpi_bus_check_scope (
- struct acpi_device *device)
-{
- int result = 0;
- int status_changed = 0;
-
- ACPI_FUNCTION_TRACE("acpi_bus_check_scope");
-
- if (!device)
- return_VALUE(-EINVAL);
-
- /* Status Change? */
- result = acpi_bus_check_device(device, &status_changed);
- if (0 != result)
- return_VALUE(result);
-
- if (!status_changed)
- return_VALUE(0);
-
- /*
- * TBD: Enumerate child devices within this device's scope and
- * run acpi_bus_check_device()'s on them.
- */
-
- return_VALUE(0);
-}
-
-
-/**
- * acpi_bus_notify
- * ---------------
- * Callback for all 'system-level' device notifications (values 0x00-0x7F).
- */
-static void
-acpi_bus_notify (
- acpi_handle handle,
- u32 type,
- void *data)
-{
- int result = 0;
- struct acpi_device *device = NULL;
-
- ACPI_FUNCTION_TRACE("acpi_bus_notify");
-
- if (0 != acpi_bus_get_device(handle, &device))
- return_VOID;
-
- switch (type) {
-
- case ACPI_NOTIFY_BUS_CHECK:
- ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received BUS CHECK notification for device [%s]\n",
- device->pnp.bus_id));
- result = acpi_bus_check_scope(device);
- /*
- * TBD: We'll need to outsource certain events to non-ACPI
- * drivers via the device manager (device.c).
- */
- break;
-
- case ACPI_NOTIFY_DEVICE_CHECK:
- ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received DEVICE CHECK notification for device [%s]\n",
- device->pnp.bus_id));
- result = acpi_bus_check_device(device, NULL);
- /*
- * TBD: We'll need to outsource certain events to non-ACPI
- * drivers via the device manager (device.c).
- */
- break;
-
- case ACPI_NOTIFY_DEVICE_WAKE:
- ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received DEVICE WAKE notification for device [%s]\n",
- device->pnp.bus_id));
- /* TBD */
- break;
-
- case ACPI_NOTIFY_EJECT_REQUEST:
- ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received EJECT REQUEST notification for device [%s]\n",
- device->pnp.bus_id));
- /* TBD */
- break;
-
- case ACPI_NOTIFY_DEVICE_CHECK_LIGHT:
- ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received DEVICE CHECK LIGHT notification for device [%s]\n",
- device->pnp.bus_id));
- /* TBD: Exactly what does 'light' mean? */
- break;
-
- case ACPI_NOTIFY_FREQUENCY_MISMATCH:
- ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received FREQUENCY MISMATCH notification for device [%s]\n",
- device->pnp.bus_id));
- /* TBD */
- break;
-
- case ACPI_NOTIFY_BUS_MODE_MISMATCH:
- ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received BUS MODE MISMATCH notification for device [%s]\n",
- device->pnp.bus_id));
- /* TBD */
- break;
-
- case ACPI_NOTIFY_POWER_FAULT:
- ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received POWER FAULT notification for device [%s]\n",
- device->pnp.bus_id));
- /* TBD */
- break;
-
- default:
- ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received unknown/unsupported notification [%08x]\n",
- type));
- break;
- }
-
- return_VOID;
-}
-
-
-/* --------------------------------------------------------------------------
- Driver Management
- -------------------------------------------------------------------------- */
-
-static LIST_HEAD(acpi_bus_drivers);
-static DECLARE_MUTEX(acpi_bus_drivers_lock);
-
-
-/**
- * acpi_bus_match
- * --------------
- * Checks the device's hardware (_HID) or compatible (_CID) ids to see if it
- * matches the specified driver's criteria.
- */
-static int
-acpi_bus_match (
- struct acpi_device *device,
- struct acpi_driver *driver)
-{
-
- if (!device || !driver)
- return -EINVAL;
-
- if (device->flags.hardware_id) {
- if (0 != strstr(driver->ids, device->pnp.hardware_id))
- return 0;
- }
-
- if (device->flags.compatible_ids) {
- acpi_status status = AE_OK;
- acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL};
- acpi_object *object = NULL;
- char cid[256];
-
- memset(cid, 0, sizeof(cid));
-
- status = acpi_evaluate_object(device->handle, "_CID", NULL,
- &buffer);
- if (ACPI_FAILURE(status) || !buffer.pointer)
- return -ENOENT;
-
- object = (acpi_object *) buffer.pointer;
-
- switch (object->type) {
- case ACPI_TYPE_INTEGER:
- acpi_ex_eisa_id_to_string((u32) object->integer.value,
- cid);
- break;
- case ACPI_TYPE_STRING:
- strncpy(cid, object->string.pointer, sizeof(cid) - 1);
- break;
- case ACPI_TYPE_PACKAGE:
- /* TBD: Support CID packages */
- break;
- }
-
- if (!cid[0])
- return -ENOENT;
-
- if (0 != strstr(driver->ids, cid))
- return 0;
- }
-
- return -ENOENT;
-}
-
-
-/**
- * acpi_bus_driver_init
- * --------------------
- * Used to initialize a device via its device driver. Called whenever a
- * driver is bound to a device. Invokes the driver's add() and start() ops.
- */
-static int
-acpi_bus_driver_init (
- struct acpi_device *device,
- struct acpi_driver *driver)
-{
- int result = 0;
-
- ACPI_FUNCTION_TRACE("acpi_bus_driver_init");
-
- if (!device || !driver)
- return_VALUE(-EINVAL);
-
- if (!driver->ops.add)
- return_VALUE(-ENOSYS);
-
- result = driver->ops.add(device);
- if (0 != result) {
- device->driver = NULL;
- acpi_driver_data(device) = NULL;
- return_VALUE(result);
- }
-
- /*
- * TBD - Configuration Management: Assign resources to device based
- * upon possible configuration and currently allocated resources.
- */
-
- if (driver->ops.start) {
- result = driver->ops.start(device);
- if ((0 != result) && (driver->ops.remove))
- driver->ops.remove(device, ACPI_BUS_REMOVAL_NORMAL);
- return_VALUE(result);
- }
-
- ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Driver successfully bound to device\n"));
-
-#ifdef CONFIG_LDM
- /*
- * Update the device information (in the global device hierarchy) now
- * that there's a driver bound to it.
- */
- strncpy(device->dev.name, device->pnp.device_name,
- sizeof(device->dev.name));
-#endif
-
- if (driver->ops.scan) {
- driver->ops.scan(device);
- }
-
- return_VALUE(0);
-}
-
-
-/**
- * acpi_bus_attach
- * -------------
- * Callback for acpi_bus_walk() used to find devices that match a specific
- * driver's criteria and then attach the driver.
- */
-static int
-acpi_bus_attach (
- struct acpi_device *device,
- int level,
- void *data)
-{
- int result = 0;
- struct acpi_driver *driver = NULL;
-
- ACPI_FUNCTION_TRACE("acpi_bus_attach");
-
- if (!device || !data)
- return_VALUE(-EINVAL);
-
- driver = (struct acpi_driver *) data;
-
- if (device->driver)
- return_VALUE(-EEXIST);
-
- if (!device->status.present)
- return_VALUE(-ENODEV);
-
- result = acpi_bus_match(device, driver);
- if (0 != result)
- return_VALUE(result);
-
- ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found driver [%s] for device [%s]\n",
- driver->name, device->pnp.bus_id));
-
- result = acpi_bus_driver_init(device, driver);
- if (0 != result)
- return_VALUE(result);
-
- down(&acpi_bus_drivers_lock);
- ++driver->references;
- up(&acpi_bus_drivers_lock);
-
- return_VALUE(0);
-}
-
-
-/**
- * acpi_bus_unattach
- * -----------------
- * Callback for acpi_bus_walk() used to find devices that match a specific
- * driver's criteria and unattach the driver.
- */
-static int
-acpi_bus_unattach (
- struct acpi_device *device,
- int level,
- void *data)
-{
- int result = 0;
- struct acpi_driver *driver = (struct acpi_driver *) data;
-
- ACPI_FUNCTION_TRACE("acpi_bus_unattach");
-
- if (!device || !driver)
- return_VALUE(-EINVAL);
-
- if (device->driver != driver)
- return_VALUE(-ENOENT);
-
- if (!driver->ops.remove)
- return_VALUE(-ENOSYS);
-
- result = driver->ops.remove(device, ACPI_BUS_REMOVAL_NORMAL);
- if (0 != result)
- return_VALUE(result);
-
- device->driver = NULL;
- acpi_driver_data(device) = NULL;
-
- down(&acpi_bus_drivers_lock);
- driver->references--;
- up(&acpi_bus_drivers_lock);
-
- return_VALUE(0);
-}
-
-
-/**
- * acpi_bus_find_driver
- * --------------------
- * Parses the list of registered drivers looking for a driver applicable for
- * the specified device.
- */
-static int
-acpi_bus_find_driver (
- struct acpi_device *device)
-{
- int result = -ENODEV;
- struct list_head *entry = NULL;
- struct acpi_driver *driver = NULL;
-
- ACPI_FUNCTION_TRACE("acpi_bus_find_driver");
-
- if (!device || device->driver)
- return_VALUE(-EINVAL);
-
- down(&acpi_bus_drivers_lock);
-
- list_for_each(entry, &acpi_bus_drivers) {
-
- driver = list_entry(entry, struct acpi_driver, node);
-
- if (0 != acpi_bus_match(device, driver))
- continue;
-
- result = acpi_bus_driver_init(device, driver);
- if (0 == result)
- ++driver->references;
-
- break;
- }
-
- up(&acpi_bus_drivers_lock);
-
- return_VALUE(result);
-}
-
-
-/**
- * acpi_bus_register_driver
- * ------------------------
- * Registers a driver with the ACPI bus. Searches the namespace for all
- * devices that match the driver's criteria and binds.
- */
-int
-acpi_bus_register_driver (
- struct acpi_driver *driver)
-{
- ACPI_FUNCTION_TRACE("acpi_bus_register_driver");
-
- if (!driver)
- return_VALUE(-EINVAL);
-
- down(&acpi_bus_drivers_lock);
- list_add_tail(&driver->node, &acpi_bus_drivers);
- up(&acpi_bus_drivers_lock);
-
- acpi_bus_walk(acpi_root, acpi_bus_attach,
- WALK_DOWN, driver);
-
- return_VALUE(driver->references);
-}
-
-
-/**
- * acpi_bus_unregister_driver
- * --------------------------
- * Unregisters a driver with the ACPI bus. Searches the namespace for all
- * devices that match the driver's criteria and unbinds.
- */
-int
-acpi_bus_unregister_driver (
- struct acpi_driver *driver)
-{
- ACPI_FUNCTION_TRACE("acpi_bus_unregister_driver");
-
- if (!driver)
- return_VALUE(-EINVAL);
-
- acpi_bus_walk(acpi_root, acpi_bus_unattach, WALK_UP, driver);
-
- if (driver->references)
- return_VALUE(driver->references);
-
- down(&acpi_bus_drivers_lock);
- list_del(&driver->node);
- up(&acpi_bus_drivers_lock);
-
- return_VALUE(0);
-}
-
-
-/* --------------------------------------------------------------------------
- Device Enumeration
- -------------------------------------------------------------------------- */
-
-static int
-acpi_bus_get_flags (
- struct acpi_device *device)
-{
- acpi_status status = AE_OK;
- acpi_handle temp = NULL;
-
- ACPI_FUNCTION_TRACE("acpi_bus_get_flags");
-
- /* Presence of _STA indicates 'dynamic_status' */
- status = acpi_get_handle(device->handle, "_STA", &temp);
- if (ACPI_SUCCESS(status))
- device->flags.dynamic_status = 1;
-
- /* Presence of _CID indicates 'compatible_ids' */
- status = acpi_get_handle(device->handle, "_CID", &temp);
- if (ACPI_SUCCESS(status))
- device->flags.compatible_ids = 1;
-
- /* Presence of _RMV indicates 'removable' */
- status = acpi_get_handle(device->handle, "_RMV", &temp);
- if (ACPI_SUCCESS(status))
- device->flags.removable = 1;
-
- /* Presence of _EJD|_EJ0 indicates 'ejectable' */
- status = acpi_get_handle(device->handle, "_EJD", &temp);
- if (ACPI_SUCCESS(status))
- device->flags.ejectable = 1;
- else {
- status = acpi_get_handle(device->handle, "_EJ0", &temp);
- if (ACPI_SUCCESS(status))
- device->flags.ejectable = 1;
- }
-
- /* Presence of _LCK indicates 'lockable' */
- status = acpi_get_handle(device->handle, "_LCK", &temp);
- if (ACPI_SUCCESS(status))
- device->flags.lockable = 1;
-
- /* Presence of _PS0|_PR0 indicates 'power manageable' */
- status = acpi_get_handle(device->handle, "_PS0", &temp);
- if (ACPI_FAILURE(status))
- status = acpi_get_handle(device->handle, "_PR0", &temp);
- if (ACPI_SUCCESS(status))
- device->flags.power_manageable = 1;
-
- /* TBD: Peformance management */
-
- return_VALUE(0);
-}
-
-
-static int
-acpi_bus_add (
- struct acpi_device **child,
- struct acpi_device *parent,
- acpi_handle handle,
- int type)
-{
- int result = 0;
- acpi_status status = AE_OK;
- struct acpi_device *device = NULL;
- char bus_id[5] = {'?',0};
- acpi_buffer buffer = {sizeof(bus_id), bus_id};
- acpi_device_info info;
- char *hid = NULL;
- char *uid = NULL;
- int i = 0;
-
- ACPI_FUNCTION_TRACE("acpi_bus_add");
-
- if (!child)
- return_VALUE(-EINVAL);
-
- device = kmalloc(sizeof(struct acpi_device), GFP_KERNEL);
- if (!device) {
- ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Memory allocation error\n"));
- return_VALUE(-ENOMEM);
- }
- memset(device, 0, sizeof(struct acpi_device));
-
- device->handle = handle;
- device->parent = parent;
-
- memset(&info, 0, sizeof(acpi_device_info));
-
- /*
- * Bus ID
- * ------
- * The device's Bus ID is simply the object name.
- * TBD: Shouldn't this value be unique (within the ACPI namespace)?
- */
- switch (type) {
- case ACPI_BUS_TYPE_SYSTEM:
- sprintf(device->pnp.bus_id, "%s", "ACPI");
- break;
- case ACPI_BUS_TYPE_POWER_BUTTON:
- sprintf(device->pnp.bus_id, "%s", "PWRF");
- break;
- case ACPI_BUS_TYPE_SLEEP_BUTTON:
- sprintf(device->pnp.bus_id, "%s", "SLPF");
- break;
- default:
- acpi_get_name(handle, ACPI_SINGLE_NAME, &buffer);
- /* Clean up trailing underscores (if any) */
- for (i = 3; i > 1; i--) {
- if (bus_id[i] == '_')
- bus_id[i] = '\0';
- else
- break;
- }
- sprintf(device->pnp.bus_id, "%s", bus_id);
- break;
- }
-
- /*
- * Flags
- * -----
- * Get prior to calling acpi_bus_get_status() so we know whether
- * or not _STA is present. Note that we only look for object
- * handles -- cannot evaluate objects until we know the device is
- * present and properly initialized.
- */
- result = acpi_bus_get_flags(device);
- if (0 != result)
- goto end;
-
- /*
- * Status
- * ------
- * See if the device is present. We always assume that non-Device()
- * objects (e.g. thermal zones, power resources, processors, etc.) are
- * present, functioning, etc. (at least when parent object is present).
- * Note that _STA has a different meaning for some objects (e.g.
- * power resources) so we need to be careful how we use it.
- */
- switch (type) {
- case ACPI_BUS_TYPE_DEVICE:
- result = acpi_bus_get_status(device);
- if (!result)
- break;
- if (!device->status.present)
- result = -ENOENT;
- goto end;
- default:
- STRUCT_TO_INT(device->status) = 0x0F;
- break;
- }
-
- /*
- * Initialize Device
- * -----------------
- * TBD: Synch with Core's enumeration/initialization process.
- */
-
- /*
- * Hardware ID, Unique ID, & Bus Address
- * -------------------------------------
- */
- switch (type) {
- case ACPI_BUS_TYPE_DEVICE:
- status = acpi_get_object_info(handle, &info);
- if (ACPI_FAILURE(status)) {
- ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
- "Error reading device info\n"));
- result = -ENODEV;
- goto end;
- }
- /* Clean up info strings (not NULL terminated) */
- info.hardware_id[sizeof(info.hardware_id)-1] = '\0';
- info.unique_id[sizeof(info.unique_id)-1] = '\0';
- if (info.valid & ACPI_VALID_HID)
- hid = info.hardware_id;
- if (info.valid & ACPI_VALID_UID)
- uid = info.unique_id;
- if (info.valid & ACPI_VALID_ADR) {
- device->pnp.bus_address = info.address;
- device->flags.bus_address = 1;
- }
- break;
- case ACPI_BUS_TYPE_POWER:
- hid = ACPI_POWER_HID;
- break;
- case ACPI_BUS_TYPE_PROCESSOR:
- hid = ACPI_PROCESSOR_HID;
- break;
- case ACPI_BUS_TYPE_SYSTEM:
- hid = ACPI_SYSTEM_HID;
- break;
- case ACPI_BUS_TYPE_THERMAL:
- hid = ACPI_THERMAL_HID;
- break;
- case ACPI_BUS_TYPE_POWER_BUTTON:
- hid = ACPI_BUTTON_HID_POWERF;
- break;
- case ACPI_BUS_TYPE_SLEEP_BUTTON:
- hid = ACPI_BUTTON_HID_SLEEPF;
- break;
- }
-
- /*
- * \_SB
- * ----
- * Fix for the system root bus device -- the only root-level device.
- */
- if ((parent == ACPI_ROOT_OBJECT) && (type == ACPI_BUS_TYPE_DEVICE)) {
- hid = ACPI_BUS_HID;
- sprintf(device->pnp.device_name, "%s", ACPI_BUS_DEVICE_NAME);
- sprintf(device->pnp.device_class, "%s", ACPI_BUS_CLASS);
- }
-
- if (hid) {
- sprintf(device->pnp.hardware_id, "%s", hid);
- device->flags.hardware_id = 1;
- }
- if (uid) {
- sprintf(device->pnp.unique_id, "%s", uid);
- device->flags.unique_id = 1;
- }
-
- /*
- * Power Management
- * ----------------
- */
- if (device->flags.power_manageable) {
- result = acpi_bus_get_power_flags(device);
- if (0 != result)
- goto end;
- }
-
- /*
- * Performance Management
- * ----------------------
- */
- if (device->flags.performance_manageable) {
- result = acpi_bus_get_perf_flags(device);
- if (0 != result)
- goto end;
- }
-
- /*
- * Context
- * -------
- * Attach this 'struct acpi_device' to the ACPI object. This makes
- * resolutions from handle->device very efficient. Note that we need
- * to be careful with fixed-feature devices as they all attach to the
- * root object.
- */
- switch (type) {
- case ACPI_BUS_TYPE_POWER_BUTTON:
- case ACPI_BUS_TYPE_SLEEP_BUTTON:
- break;
- default:
- status = acpi_attach_data(device->handle,
- acpi_bus_data_handler, device);
- break;
- }
- if (ACPI_FAILURE(status)) {
- ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
- "Error attaching device data\n"));
- result = -ENODEV;
- goto end;
- }
-
- /*
- * Linkage
- * -------
- * Link this device to its parent and siblings.
- */
- INIT_LIST_HEAD(&device->children);
- if (!device->parent)
- INIT_LIST_HEAD(&device->node);
- else
- list_add_tail(&device->node, &device->parent->children);
-
-#ifdef CONFIG_ACPI_DEBUG
- {
- char *type_string = NULL;
- char name[80] = {'?','\0'};
- acpi_buffer buffer = {sizeof(name), name};
-
- acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer);
-
- switch (type) {
- case ACPI_BUS_TYPE_DEVICE:
- type_string = "Device";
- break;
- case ACPI_BUS_TYPE_POWER:
- type_string = "Power Resource";
- break;
- case ACPI_BUS_TYPE_PROCESSOR:
- type_string = "Processor";
- break;
- case ACPI_BUS_TYPE_SYSTEM:
- type_string = "System";
- break;
- case ACPI_BUS_TYPE_THERMAL:
- type_string = "Thermal Zone";
- break;
- case ACPI_BUS_TYPE_POWER_BUTTON:
- type_string = "Power Button";
- sprintf(name, "PWRB");
- break;
- case ACPI_BUS_TYPE_SLEEP_BUTTON:
- type_string = "Sleep Button";
- sprintf(name, "SLPB");
- break;
- }
-
- ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found %s %s [%p]\n",
- type_string, name, handle));
- }
-#endif /*CONFIG_ACPI_DEBUG*/
-
- /*
- * Global Device Hierarchy:
- * ------------------------
- * Register this device with the global device hierarchy.
- */
- acpi_device_register(device, parent);
-
- /*
- * Bind _ADR-Based Devices
- * -----------------------
- * If there's a a bus address (_ADR) then we utilize the parent's
- * 'bind' function (if exists) to bind the ACPI- and natively-
- * enumerated device representations.
- */
- if (device->flags.bus_address) {
- if (device->parent && device->parent->ops.bind)
- device->parent->ops.bind(device);
- }
-
- /*
- * Locate & Attach Driver
- * ----------------------
- * If there's a hardware id (_HID) or compatible ids (_CID) we check
- * to see if there's a driver installed for this kind of device. Note
- * that drivers can install before or after a device in enumerated.
- *
- * TBD: Assumes LDM provides driver hot-plug capability.
- */
- if (device->flags.hardware_id || device->flags.compatible_ids)
- acpi_bus_find_driver(device);
-
-end:
- if (0 != result) {
- kfree(device);
- return_VALUE(result);
- }
-
- *child = device;
-
- return_VALUE(0);
-}
-
-
-static int
-acpi_bus_remove (
- struct acpi_device *device,
- int type)
-{
- ACPI_FUNCTION_TRACE("acpi_bus_remove");
-
- if (!device)
- return_VALUE(-ENODEV);
-
- acpi_device_unregister(device);
-
- kfree(device);
-
- return_VALUE(0);
-}
-
-
-int
-acpi_bus_scan (
- struct acpi_device *start)
-{
- acpi_status status = AE_OK;
- struct acpi_device *parent = NULL;
- struct acpi_device *child = NULL;
- acpi_handle phandle = 0;
- acpi_handle chandle = 0;
- acpi_object_type type = 0;
- u32 level = 1;
-
- ACPI_FUNCTION_TRACE("acpi_bus_scan");
-
- if (!start)
- return_VALUE(-EINVAL);
-
- parent = start;
- phandle = start->handle;
-
- /*
- * Parse through the ACPI namespace, identify all 'devices', and
- * create a new 'struct acpi_device' for each.
- */
- while ((level > 0) && parent) {
-
- status = acpi_get_next_object(ACPI_TYPE_ANY, phandle,
- chandle, &chandle);
-
- /*
- * If this scope is exhausted then move our way back up.
- */
- if (ACPI_FAILURE(status)) {
- level--;
- chandle = phandle;
- acpi_get_parent(phandle, &phandle);
- if (parent->parent)
- parent = parent->parent;
- continue;
- }
-
- status = acpi_get_type(chandle, &type);
- if (ACPI_FAILURE(status))
- continue;
-
- /*
- * If this is a scope object then parse it (depth-first).
- */
- if (type == ACPI_TYPE_ANY) {
- /* Hack to get around scope identity problem */
- status = acpi_get_next_object(ACPI_TYPE_ANY, chandle, 0, NULL);
- if (ACPI_SUCCESS(status)) {
- level++;
- phandle = chandle;
- chandle = 0;
- }
- continue;
- }
-
- /*
- * We're only interested in objects that we consider 'devices'.
- */
- switch (type) {
- case ACPI_TYPE_DEVICE:
- type = ACPI_BUS_TYPE_DEVICE;
- break;
- case ACPI_TYPE_PROCESSOR:
- type = ACPI_BUS_TYPE_PROCESSOR;
- break;
- case ACPI_TYPE_THERMAL:
- type = ACPI_BUS_TYPE_THERMAL;
- break;
- case ACPI_TYPE_POWER:
- type = ACPI_BUS_TYPE_POWER;
- break;
- default:
- continue;
- }
-
- status = acpi_bus_add(&child, parent, chandle, type);
- if (ACPI_FAILURE(status))
- continue;
-
- /*
- * If the device is present, enabled, and functioning then
- * parse its scope (depth-first). Note that we need to
- * represent absent devices to facilitate PnP notifications
- * -- but only the subtree head (not all of its children,
- * which will be enumerated when the parent is inserted).
- *
- * TBD: Need notifications and other detection mechanisms
- * in place before we can fully implement this.
- */
- if (child->status.present) {
- status = acpi_get_next_object(ACPI_TYPE_ANY, chandle,
- 0, NULL);
- if (ACPI_SUCCESS(status)) {
- level++;
- phandle = chandle;
- chandle = 0;
- parent = child;
- }
- }
- }
-
- return_VALUE(0);
-}
-
-
-static int
-acpi_bus_scan_fixed (
- struct acpi_device *root)
-{
- int result = 0;
- struct acpi_device *device = NULL;
-
- ACPI_FUNCTION_TRACE("acpi_bus_scan");
-
- if (!root)
- return_VALUE(-ENODEV);
-
- /*
- * Enumerate all fixed-feature devices.
- */
- if (acpi_fadt.pwr_button == 0)
- result = acpi_bus_add(&device, acpi_root,
- ACPI_ROOT_OBJECT, ACPI_BUS_TYPE_POWER_BUTTON);
-
- if (acpi_fadt.sleep_button == 0)
- result = acpi_bus_add(&device, acpi_root,
- ACPI_ROOT_OBJECT, ACPI_BUS_TYPE_SLEEP_BUTTON);
-
- return_VALUE(result);
-}
-
-
-/* --------------------------------------------------------------------------
- Initialization/Cleanup
- -------------------------------------------------------------------------- */
-
-int __init
-acpi_blacklisted(void)
-{
- int i = 0;
- int blacklisted = 0;
- acpi_table_header table_header;
-
- while (acpi_blacklist[i].oem_id[0] != '\0')
- {
- if (!ACPI_SUCCESS(acpi_get_table_header(acpi_blacklist[i].table, 1, &table_header))) {
- i++;
- continue;
- }
-
- if (strncmp(acpi_blacklist[i].oem_id, table_header.oem_id, 6)) {
- i++;
- continue;
- }
-
- if (strncmp(acpi_blacklist[i].oem_table_id, table_header.oem_table_id, 8)) {
- i++;
- continue;
- }
-
- if ((acpi_blacklist[i].oem_revision_predicate == all_versions)
- || (acpi_blacklist[i].oem_revision_predicate == less_than_or_equal
- && table_header.oem_revision <= acpi_blacklist[i].oem_revision)
- || (acpi_blacklist[i].oem_revision_predicate == greater_than_or_equal
- && table_header.oem_revision >= acpi_blacklist[i].oem_revision)
- || (acpi_blacklist[i].oem_revision_predicate == equal
- && table_header.oem_revision == acpi_blacklist[i].oem_revision)) {
-
- printk(KERN_ERR PREFIX "Vendor \"%6.6s\" System \"%8.8s\" "
- "Revision 0x%x has a known ACPI BIOS problem.\n",
- acpi_blacklist[i].oem_id,
- acpi_blacklist[i].oem_table_id,
- acpi_blacklist[i].oem_revision);
-
- printk(KERN_ERR PREFIX "Reason: %s. This is a %s error\n",
- acpi_blacklist[i].reason,
- (acpi_blacklist[i].is_critical_error ? "non-recoverable" : "recoverable"));
-
- blacklisted = acpi_blacklist[i].is_critical_error;
- break;
- }
- else {
- i++;
- }
- }
-
- return blacklisted;
-}
-
-static int __init
-acpi_bus_init_irq (void)
-{
- acpi_status status = AE_OK;
- acpi_object arg = {ACPI_TYPE_INTEGER};
- acpi_object_list arg_list = {1, &arg};
- char *message = NULL;
-
- ACPI_FUNCTION_TRACE("acpi_bus_init_irq");
-
- /*
- * Let the system know what interrupt model we are using by
- * evaluating the \_PIC object, if exists.
- */
-
- switch (acpi_irq_model) {
- case ACPI_IRQ_MODEL_PIC:
- message = "PIC";
- break;
- case ACPI_IRQ_MODEL_IOAPIC:
- message = "IOAPIC";
- break;
- case ACPI_IRQ_MODEL_IOSAPIC:
- message = "IOSAPIC";
- break;
- default:
- printk(KERN_WARNING PREFIX "Unknown interrupt routing model\n");
- return_VALUE(-ENODEV);
- }
-
- printk(KERN_INFO PREFIX "Using %s for interrupt routing\n", message);
-
- arg.integer.value = acpi_irq_model;
-
- status = acpi_evaluate_object(NULL, "\\_PIC", &arg_list, NULL);
- if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) {
- ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _PIC\n"));
- return_VALUE(-ENODEV);
- }
-
- return_VALUE(0);
-}
-
-
-static int __init
-acpi_bus_init (void)
-{
- int result = 0;
- acpi_status status = AE_OK;
- acpi_buffer buffer = {sizeof(acpi_fadt), &acpi_fadt};
- int progress = 0;
-
- ACPI_FUNCTION_TRACE("acpi_bus_init");
-
- /*
- * [0] Initailize the ACPI Core Subsystem.
- */
- status = acpi_initialize_subsystem();
- if (ACPI_FAILURE(status)) {
- printk(KERN_ERR PREFIX "Unable to initialize the ACPI Interpreter\n");
- result = -ENODEV;
- goto end;
- }
-
- progress++;
-
- /*
- * [1] Load the ACPI tables.
- */
- status = acpi_load_tables();
- if (ACPI_FAILURE(status)) {
- printk(KERN_ERR PREFIX "Unable to load the System Description Tables\n");
- result = -ENODEV;
- goto end;
- }
-
- progress++;
-
- /*
- * [2] Check the blacklist
- */
- if (acpi_blacklisted()) {
- result = -ENODEV;
- goto end;
- }
-
- progress++;
-
- /*
- * [3] Get a separate copy of the FADT for use by other drivers.
- */
- status = acpi_get_table(ACPI_TABLE_FADT, 1, &buffer);
- if (ACPI_FAILURE(status)) {
- printk(KERN_ERR PREFIX "Unable to get the FADT\n");
- result = -ENODEV;
- goto end;
- }
-
- progress++;
-
- /*
- * [4] Enable the ACPI Core Subsystem.
- */
- status = acpi_enable_subsystem(ACPI_FULL_INITIALIZATION);
- if (ACPI_FAILURE(status)) {
- printk(KERN_ERR PREFIX "Unable to start the ACPI Interpreter\n");
- result = -ENODEV;
- goto end;
- }
-
- printk(KERN_INFO PREFIX "Interpreter enabled\n");
-
- progress++;
-
- /*
- * [5] Get the system interrupt model and evaluate \_PIC.
- */
- result = acpi_bus_init_irq();
- if (0 != result)
- goto end;
-
- progress++;
-
- /*
- * [6] Register for all standard device notifications.
- */
- status = acpi_install_notify_handler(ACPI_ROOT_OBJECT, ACPI_SYSTEM_NOTIFY, &acpi_bus_notify, NULL);
- if (ACPI_FAILURE(status)) {
- printk(KERN_ERR PREFIX "Unable to register for device notifications\n");
- result = -ENODEV;
- goto end;
- }
-
- progress++;
-
- /*
- * [7] Create the root device.
- */
- result = acpi_bus_add(&acpi_root, NULL, ACPI_ROOT_OBJECT,
- ACPI_BUS_TYPE_SYSTEM);
- if (0 != result)
- goto end;
-
- progress++;
-
- /*
- * [8] Create the root file system.
- */
- acpi_device_dir(acpi_root) = proc_mkdir(ACPI_BUS_FILE_ROOT, NULL);
- if (!acpi_root) {
- result = -ENODEV;
- goto end;
- }
- acpi_root_dir = acpi_device_dir(acpi_root);
-
- progress++;
-
- /*
- * [9] Install drivers required for proper enumeration of the
- * ACPI namespace.
- */
- acpi_system_init(); /* ACPI System */
- acpi_power_init(); /* ACPI Bus Power Management */
-#ifdef CONFIG_ACPI_EC
- acpi_ec_init(); /* ACPI Embedded Controller */
-#endif
-#ifdef CONFIG_ACPI_PCI
- acpi_pci_link_init(); /* ACPI PCI Interrupt Link */
- acpi_pci_root_init(); /* ACPI PCI Root Bridge */
-#endif
- progress++;
-
- /*
- * [10] Enumerate devices in the ACPI namespace.
- */
- result = acpi_bus_scan_fixed(acpi_root);
- if (0 != result)
- goto end;
- result = acpi_bus_scan(acpi_root);
- if (0 != result)
- goto end;
-
-end:
- /*
- * Clean up if anything went awry.
- */
- if (0 != result) {
- switch (progress) {
- case 10:
- case 9: remove_proc_entry("ACPI", NULL);
- case 8: acpi_bus_remove(acpi_root, ACPI_BUS_REMOVAL_NORMAL);
- case 7: acpi_remove_notify_handler(ACPI_ROOT_OBJECT,
- ACPI_SYSTEM_NOTIFY, &acpi_bus_notify);
- case 6:
- case 5:
- case 4:
- case 3:
- case 2: acpi_terminate();
- case 1:
- case 0:
- default: return_VALUE(-ENODEV);
- }
- }
-
- return_VALUE(0);
-}
-
-
-static void __exit
-acpi_bus_exit (void)
-{
- acpi_status status = AE_OK;
-
- ACPI_FUNCTION_TRACE("acpi_bus_exit");
-
- status = acpi_remove_notify_handler(ACPI_ROOT_OBJECT,
- ACPI_SYSTEM_NOTIFY, acpi_bus_notify);
- if (ACPI_FAILURE(status))
- ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
- "Error removing notify handler\n"));
-
-#ifdef CONFIG_ACPI_PCI
- acpi_pci_root_exit();
- acpi_pci_link_exit();
-#endif
-#ifdef CONFIG_ACPI_EC
- acpi_ec_exit();
-#endif
- acpi_power_exit();
- acpi_system_exit();
-
- acpi_bus_remove(acpi_root, ACPI_BUS_REMOVAL_NORMAL);
-
- remove_proc_entry(ACPI_BUS_FILE_ROOT, NULL);
-
- status = acpi_terminate();
- if (ACPI_FAILURE(status))
- printk(KERN_ERR PREFIX "Unable to terminate the ACPI Interpreter\n");
- else
- printk(KERN_ERR PREFIX "Interpreter disabled\n");
-
- return_VOID;
-}
-
-
-int __init
-acpi_init (void)
-{
- int result = 0;
-
- ACPI_FUNCTION_TRACE("acpi_init");
-
- memset(&acpi_fadt, 0, sizeof(FADT_DESCRIPTOR));
-
- printk(KERN_INFO PREFIX "Subsystem revision %08x\n",
- ACPI_CA_VERSION);
-
- /* Initial core debug level excludes drivers, so include them now */
- acpi_set_debug(ACPI_DEBUG_LOW);
-
- if (acpi_disabled) {
- printk(KERN_INFO PREFIX "Disabled via command line (acpi=off)\n");
- return -ENODEV;
- }
-
-#ifdef CONFIG_PM
- if (PM_IS_ACTIVE()) {
- printk(KERN_INFO PREFIX "APM is already active, exiting\n");
- return -ENODEV;
- }
-#endif
-
- result = acpi_bus_init();
- if (0 != result)
- return_VALUE(result);
-
-#ifdef CONFIG_PM
- pm_active = 1;
-#endif
-
- return_VALUE(0);
-}
-
-
-void __exit
-acpi_exit (void)
-{
- ACPI_FUNCTION_TRACE("acpi_exit");
-
-#ifdef CONFIG_PM
- pm_active = 0;
-#endif
-
- acpi_bus_exit();
-
- return_VOID;
-}
-
-
-int __init
-acpi_setup(char *str)
-{
- while (str && *str) {
- if (strncmp(str, "off", 3) == 0)
- acpi_disabled = 1;
- str = strchr(str, ',');
- if (str)
- str += strspn(str, ", \t");
- }
- return 1;
-}
-
-
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
-subsys_initcall(acpi_init);
-#endif
-
-__setup("acpi=", acpi_setup);
-
diff -Nru a/drivers/acpi/button.c b/drivers/acpi/button.c
--- a/drivers/acpi/button.c Wed Oct 8 09:05:46 2003
+++ /dev/null Wed Dec 31 16:00:00 1969
@@ -1,420 +0,0 @@
-/*
- * acpi_button.c - ACPI Button Driver ($Revision: 25 $)
- *
- * Copyright (C) 2001, 2002 Andy Grover
- * Copyright (C) 2001, 2002 Paul Diefenbaugh
- *
- * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at
- * your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- *
- * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- */
-
-#include
-#include
-#include
-#include
-#include "acpi_bus.h"
-#include "acpi_drivers.h"
-
-
-#define _COMPONENT ACPI_BUTTON_COMPONENT
-ACPI_MODULE_NAME ("acpi_button")
-
-MODULE_AUTHOR("Paul Diefenbaugh");
-MODULE_DESCRIPTION(ACPI_BUTTON_DRIVER_NAME);
-MODULE_LICENSE("GPL");
-
-#define PREFIX "ACPI: "
-
-
-int acpi_button_add (struct acpi_device *device);
-int acpi_button_remove (struct acpi_device *device, int type);
-
-static struct acpi_driver acpi_button_driver = {
- name: ACPI_BUTTON_DRIVER_NAME,
- class: ACPI_BUTTON_CLASS,
- ids: "ACPI_FPB,ACPI_FSB,PNP0C0D,PNP0C0C,PNP0C0E",
- ops: {
- add: acpi_button_add,
- remove: acpi_button_remove,
- },
-};
-
-struct acpi_button {
- acpi_handle handle;
- struct acpi_device *device; /* Fixed button kludge */
- u8 type;
- unsigned long pushed;
-};
-
-
-/* --------------------------------------------------------------------------
- FS Interface (/proc)
- -------------------------------------------------------------------------- */
-
-#include
-#include
-
-static struct proc_dir_entry *acpi_button_dir = NULL;
-
-
-static int
-acpi_button_read_info (
- char *page,
- char **start,
- off_t off,
- int count,
- int *eof,
- void *data)
-{
- struct acpi_button *button = (struct acpi_button *) data;
- char *p = page;
- int len = 0;
-
- ACPI_FUNCTION_TRACE("acpi_button_read_info");
-
- if (!button || !button->device)
- goto end;
-
- p += sprintf(p, "type: %s\n",
- acpi_device_name(button->device));
-
-end:
- len = (p - page);
- if (len <= off+count) *eof = 1;
- *start = page + off;
- len -= off;
- if (len>count) len = count;
- if (len<0) len = 0;
-
- return_VALUE(len);
-}
-
-
-static int
-acpi_button_add_fs (
- struct acpi_device *device)
-{
- static struct proc_dir_entry *power_entry;
- static struct proc_dir_entry *sleep_entry;
- static struct proc_dir_entry *lid_entry;
- struct proc_dir_entry *entry = NULL;
- struct acpi_button *button = NULL;
-
- ACPI_FUNCTION_TRACE("acpi_button_add_fs");
-
- if (!device || !acpi_driver_data(device))
- return_VALUE(-EINVAL);
-
- button = acpi_driver_data(device);
-
- if (!acpi_button_dir) {
- acpi_button_dir = proc_mkdir(ACPI_BUTTON_CLASS, acpi_root_dir);
- if (!acpi_button_dir)
- return_VALUE(-ENODEV);
- }
-
- switch (button->type) {
- case ACPI_BUTTON_TYPE_POWER:
- case ACPI_BUTTON_TYPE_POWERF:
- if (!power_entry)
- power_entry = proc_mkdir(ACPI_BUTTON_SUBCLASS_POWER,
- acpi_button_dir);
- entry = power_entry;
- break;
- case ACPI_BUTTON_TYPE_SLEEP:
- case ACPI_BUTTON_TYPE_SLEEPF:
- if (!sleep_entry)
- sleep_entry = proc_mkdir(ACPI_BUTTON_SUBCLASS_SLEEP,
- acpi_button_dir);
- entry = sleep_entry;
- break;
- case ACPI_BUTTON_TYPE_LID:
- if (!lid_entry)
- lid_entry = proc_mkdir(ACPI_BUTTON_SUBCLASS_LID,
- acpi_button_dir);
- entry = lid_entry;
- break;
- }
-
- acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), entry);
- if (!acpi_device_dir(device))
- return_VALUE(-ENODEV);
-
- /* 'info' [R] */
- entry = create_proc_entry(ACPI_BUTTON_FILE_INFO,
- S_IRUGO, acpi_device_dir(device));
- if (!entry)
- ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
- "Unable to create '%s' fs entry\n",
- ACPI_BUTTON_FILE_INFO));
- else {
- entry->read_proc = acpi_button_read_info;
- entry->data = acpi_driver_data(device);
- }
-
- return_VALUE(0);
-}
-
-
-static int
-acpi_button_remove_fs (
- struct acpi_device *device)
-{
- ACPI_FUNCTION_TRACE("acpi_button_remove_fs");
-
- if (!acpi_button_dir)
- return_VALUE(-ENODEV);
-
- if (acpi_device_dir(device))
- remove_proc_entry(acpi_device_bid(device), acpi_button_dir);
-
- return_VALUE(0);
-}
-
-
-/* --------------------------------------------------------------------------
- Driver Interface
- -------------------------------------------------------------------------- */
-
-void
-acpi_button_notify (
- acpi_handle handle,
- u32 event,
- void *data)
-{
- struct acpi_button *button = (struct acpi_button *) data;
-
- ACPI_FUNCTION_TRACE("acpi_button_notify");
-
- if (!button || !button->device)
- return_VOID;
-
- switch (event) {
- case ACPI_BUTTON_NOTIFY_STATUS:
- acpi_bus_generate_event(button->device, event, ++button->pushed);
- break;
- default:
- ACPI_DEBUG_PRINT((ACPI_DB_INFO,
- "Unsupported event [0x%x]\n", event));
- break;
- }
-
- return_VOID;
-}
-
-
-acpi_status
-acpi_button_notify_fixed (
- void *data)
-{
- struct acpi_button *button = (struct acpi_button *) data;
-
- ACPI_FUNCTION_TRACE("acpi_button_notify_fixed");
-
- if (!button)
- return_ACPI_STATUS(AE_BAD_PARAMETER);
-
- acpi_button_notify(button->handle, ACPI_BUTTON_NOTIFY_STATUS, button);
-
- return_ACPI_STATUS(AE_OK);
-}
-
-
-int
-acpi_button_add (
- struct acpi_device *device)
-{
- int result = 0;
- acpi_status status = AE_OK;
- struct acpi_button *button = NULL;
-
- ACPI_FUNCTION_TRACE("acpi_button_add");
-
- if (!device)
- return_VALUE(-EINVAL);
-
- button = kmalloc(sizeof(struct acpi_button), GFP_KERNEL);
- if (!button)
- return_VALUE(-ENOMEM);
- memset(button, 0, sizeof(struct acpi_button));
-
- button->device = device;
- button->handle = device->handle;
- acpi_driver_data(device) = button;
-
- /*
- * Determine the button type (via hid), as fixed-feature buttons
- * need to be handled a bit differently than generic-space.
- */
- if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_POWER)) {
- button->type = ACPI_BUTTON_TYPE_POWER;
- sprintf(acpi_device_name(device), "%s",
- ACPI_BUTTON_DEVICE_NAME_POWER);
- sprintf(acpi_device_class(device), "%s/%s",
- ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_POWER);
- }
- else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_POWERF)) {
- button->type = ACPI_BUTTON_TYPE_POWERF;
- sprintf(acpi_device_name(device), "%s",
- ACPI_BUTTON_DEVICE_NAME_POWERF);
- sprintf(acpi_device_class(device), "%s/%s",
- ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_POWER);
- }
- else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_SLEEP)) {
- button->type = ACPI_BUTTON_TYPE_SLEEP;
- sprintf(acpi_device_name(device), "%s",
- ACPI_BUTTON_DEVICE_NAME_SLEEP);
- sprintf(acpi_device_class(device), "%s/%s",
- ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_SLEEP);
- }
- else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_SLEEPF)) {
- button->type = ACPI_BUTTON_TYPE_SLEEPF;
- sprintf(acpi_device_name(device), "%s",
- ACPI_BUTTON_DEVICE_NAME_SLEEPF);
- sprintf(acpi_device_class(device), "%s/%s",
- ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_SLEEP);
- }
- else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_LID)) {
- button->type = ACPI_BUTTON_TYPE_LID;
- sprintf(acpi_device_name(device), "%s",
- ACPI_BUTTON_DEVICE_NAME_LID);
- sprintf(acpi_device_class(device), "%s/%s",
- ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_LID);
- }
- else {
- ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unsupported hid [%s]\n",
- acpi_device_hid(device)));
- result = -ENODEV;
- goto end;
- }
-
- result = acpi_button_add_fs(device);
- if (0 != result)
- goto end;
-
- switch (button->type) {
- case ACPI_BUTTON_TYPE_POWERF:
- status = acpi_install_fixed_event_handler (
- ACPI_EVENT_POWER_BUTTON,
- acpi_button_notify_fixed,
- button);
- break;
- case ACPI_BUTTON_TYPE_SLEEPF:
- status = acpi_install_fixed_event_handler (
- ACPI_EVENT_SLEEP_BUTTON,
- acpi_button_notify_fixed,
- button);
- break;
- default:
- status = acpi_install_notify_handler (
- button->handle,
- ACPI_DEVICE_NOTIFY,
- acpi_button_notify,
- button);
- break;
- }
-
- if (ACPI_FAILURE(status)) {
- ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
- "Error installing notify handler\n"));
- result = -ENODEV;
- goto end;
- }
-
- printk(KERN_INFO PREFIX "%s [%s]\n",
- acpi_device_name(device), acpi_device_bid(device));
-
-end:
- if (0 != result) {
- acpi_button_remove_fs(device);
- kfree(button);
- }
-
- return_VALUE(result);
-}
-
-
-int
-acpi_button_remove (struct acpi_device *device, int type)
-{
- acpi_status status = 0;
- struct acpi_button *button = NULL;
-
- ACPI_FUNCTION_TRACE("acpi_button_remove");
-
- if (!device || !acpi_driver_data(device))
- return_VALUE(-EINVAL);
-
- button = acpi_driver_data(device);
-
- /* Unregister for device notifications. */
- switch (button->type) {
- case ACPI_BUTTON_TYPE_POWERF:
- status = acpi_remove_fixed_event_handler(
- ACPI_EVENT_POWER_BUTTON, acpi_button_notify_fixed);
- break;
- case ACPI_BUTTON_TYPE_SLEEPF:
- status = acpi_remove_fixed_event_handler(
- ACPI_EVENT_SLEEP_BUTTON, acpi_button_notify_fixed);
- break;
- default:
- status = acpi_remove_notify_handler(button->handle,
- ACPI_DEVICE_NOTIFY, acpi_button_notify);
- break;
- }
-
- if (ACPI_FAILURE(status))
- ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
- "Error removing notify handler\n"));
-
- acpi_button_remove_fs(device);
-
- kfree(button);
-
- return_VALUE(0);
-}
-
-
-static int __init
-acpi_button_init (void)
-{
- int result = 0;
-
- ACPI_FUNCTION_TRACE("acpi_button_init");
-
- result = acpi_bus_register_driver(&acpi_button_driver);
- if (0 > result)
- return_VALUE(-ENODEV);
-
- return_VALUE(0);
-}
-
-
-static void __exit
-acpi_button_exit (void)
-{
- ACPI_FUNCTION_TRACE("acpi_button_exit");
-
- acpi_bus_unregister_driver(&acpi_button_driver);
-
- return_VOID;
-}
-
-
-module_init(acpi_button_init);
-module_exit(acpi_button_exit);
diff -Nru a/drivers/acpi/debugger/Makefile b/drivers/acpi/debugger/Makefile
--- a/drivers/acpi/debugger/Makefile Wed Oct 8 09:05:46 2003
+++ /dev/null Wed Dec 31 16:00:00 1969
@@ -1,11 +0,0 @@
-#
-# Makefile for all Linux ACPI interpreter subdirectories
-#
-
-O_TARGET := $(notdir $(CURDIR)).o
-
-obj-$(CONFIG_ACPI_INTERPRETER) := $(patsubst %.c,%.o,$(wildcard *.c))
-
-EXTRA_CFLAGS += $(ACPI_CFLAGS)
-
-include $(TOPDIR)/Rules.make
diff -Nru a/drivers/acpi/debugger/dbcmds.c b/drivers/acpi/debugger/dbcmds.c
--- a/drivers/acpi/debugger/dbcmds.c Wed Oct 8 09:05:45 2003
+++ /dev/null Wed Dec 31 16:00:00 1969
@@ -1,1112 +0,0 @@
-/*******************************************************************************
- *
- * Module Name: dbcmds - debug commands and output routines
- * $Revision: 83 $
- *
- ******************************************************************************/
-
-/*
- * Copyright (C) 2000 - 2002, R. Byron Moore
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-
-#include "acpi.h"
-#include "acdispat.h"
-#include "amlcode.h"
-#include "acnamesp.h"
-#include "acevents.h"
-#include "acdebug.h"
-#include "acresrc.h"
-
-#ifdef ENABLE_DEBUGGER
-
-#define _COMPONENT ACPI_DEBUGGER
- ACPI_MODULE_NAME ("dbcmds")
-
-
-/*
- * Arguments for the Objects command
- * These object types map directly to the ACPI_TYPES
- */
-
-static ARGUMENT_INFO acpi_db_object_types [] =
-{ {"ANY"},
- {"NUMBERS"},
- {"STRINGS"},
- {"BUFFERS"},
- {"PACKAGES"},
- {"FIELDS"},
- {"DEVICES"},
- {"EVENTS"},
- {"METHODS"},
- {"MUTEXES"},
- {"REGIONS"},
- {"POWERRESOURCES"},
- {"PROCESSORS"},
- {"THERMALZONES"},
- {"BUFFERFIELDS"},
- {"DDBHANDLES"},
- {NULL} /* Must be null terminated */
-};
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_db_walk_for_references
- *
- * PARAMETERS: Callback from Walk_namespace
- *
- * RETURN: Status
- *
- * DESCRIPTION: Check if this namespace object refers to the target object
- * that is passed in as the context value.
- *
- * Note: Currently doesn't check subobjects within the Node's object
- *
- ******************************************************************************/
-
-acpi_status
-acpi_db_walk_for_references (
- acpi_handle obj_handle,
- u32 nesting_level,
- void *context,
- void **return_value)
-{
- acpi_operand_object *obj_desc = (acpi_operand_object *) context;
- acpi_namespace_node *node = (acpi_namespace_node *) obj_handle;
-
-
- /* Check for match against the namespace node itself */
-
- if (node == (void *) obj_desc) {
- acpi_os_printf ("Object is a Node [%4.4s]\n", node->name.ascii);
- }
-
- /* Check for match against the object attached to the node */
-
- if (acpi_ns_get_attached_object (node) == obj_desc) {
- acpi_os_printf ("Reference at Node->Object %p [%4.4s]\n", node, node->name.ascii);
- }
-
- return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_db_find_references
- *
- * PARAMETERS: Object_arg - String with hex value of the object
- *
- * RETURN: None
- *
- * DESCRIPTION: Search namespace for all references to the input object
- *
- ******************************************************************************/
-
-void
-acpi_db_find_references (
- NATIVE_CHAR *object_arg)
-{
- acpi_operand_object *obj_desc;
-
-
- /* Convert string to object pointer */
-
- obj_desc = ACPI_TO_POINTER (ACPI_STRTOUL (object_arg, NULL, 16));
-
- /* Search all nodes in namespace */
-
- (void) acpi_walk_namespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
- acpi_db_walk_for_references, (void *) obj_desc, NULL);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_db_display_locks
- *
- * PARAMETERS: None
- *
- * RETURN: None
- *
- * DESCRIPTION: Display information about internal mutexes.
- *
- ******************************************************************************/
-
-void
-acpi_db_display_locks (void)
-{
- u32 i;
-
-
- for (i = 0; i < MAX_MTX; i++) {
- acpi_os_printf ("%26s : %s\n", acpi_ut_get_mutex_name (i),
- acpi_gbl_acpi_mutex_info[i].owner_id == ACPI_MUTEX_NOT_ACQUIRED
- ? "Locked" : "Unlocked");
- }
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_db_display_table_info
- *
- * PARAMETERS: Table_arg - String with name of table to be displayed
- *
- * RETURN: None
- *
- * DESCRIPTION: Display information about loaded tables. Current
- * implementation displays all loaded tables.
- *
- ******************************************************************************/
-
-void
-acpi_db_display_table_info (
- NATIVE_CHAR *table_arg)
-{
- u32 i;
-
-
- for (i = 0; i < NUM_ACPI_TABLES; i++) {
- if (acpi_gbl_acpi_tables[i].pointer) {
- acpi_os_printf ("%s at %p length %X\n", acpi_gbl_acpi_table_data[i].name,
- acpi_gbl_acpi_tables[i].pointer, acpi_gbl_acpi_tables[i].length);
- }
- }
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_db_unload_acpi_table
- *
- * PARAMETERS: Table_arg - Name of the table to be unloaded
- * Instance_arg - Which instance of the table to unload (if
- * there are multiple tables of the same type)
- *
- * RETURN: Nonde
- *
- * DESCRIPTION: Unload an ACPI table.
- * Instance is not implemented
- *
- ******************************************************************************/
-
-void
-acpi_db_unload_acpi_table (
- NATIVE_CHAR *table_arg,
- NATIVE_CHAR *instance_arg)
-{
- u32 i;
- acpi_status status;
-
-
- /* Search all tables for the target type */
-
- for (i = 0; i < NUM_ACPI_TABLES; i++) {
- if (!ACPI_STRNCMP (table_arg, acpi_gbl_acpi_table_data[i].signature,
- acpi_gbl_acpi_table_data[i].sig_length)) {
- /* Found the table, unload it */
-
- status = acpi_unload_table (i);
- if (ACPI_SUCCESS (status)) {
- acpi_os_printf ("[%s] unloaded and uninstalled\n", table_arg);
- }
- else {
- acpi_os_printf ("%s, while unloading [%s]\n",
- acpi_format_exception (status), table_arg);
- }
-
- return;
- }
- }
-
- acpi_os_printf ("Unknown table type [%s]\n", table_arg);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_db_set_method_breakpoint
- *
- * PARAMETERS: Location - AML offset of breakpoint
- * Walk_state - Current walk info
- * Op - Current Op (from parse walk)
- *
- * RETURN: None
- *
- * DESCRIPTION: Set a breakpoint in a control method at the specified
- * AML offset
- *
- ******************************************************************************/
-
-void
-acpi_db_set_method_breakpoint (
- NATIVE_CHAR *location,
- acpi_walk_state *walk_state,
- acpi_parse_object *op)
-{
- u32 address;
-
-
- if (!op) {
- acpi_os_printf ("There is no method currently executing\n");
- return;
- }
-
- /* Get and verify the breakpoint address */
-
- address = ACPI_STRTOUL (location, NULL, 16);
- if (address <= op->common.aml_offset) {
- acpi_os_printf ("Breakpoint %X is beyond current address %X\n", address, op->common.aml_offset);
- }
-
- /* Save breakpoint in current walk */
-
- walk_state->user_breakpoint = address;
- acpi_os_printf ("Breakpoint set at AML offset %X\n", address);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_db_set_method_call_breakpoint
- *
- * PARAMETERS: Op - Current Op (from parse walk)
- *
- * RETURN: None
- *
- * DESCRIPTION: Set a breakpoint in a control method at the specified
- * AML offset
- *
- ******************************************************************************/
-
-void
-acpi_db_set_method_call_breakpoint (
- acpi_parse_object *op)
-{
-
-
- if (!op) {
- acpi_os_printf ("There is no method currently executing\n");
- return;
- }
-
-
- acpi_gbl_step_to_next_call = TRUE;
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_db_disassemble_aml
- *
- * PARAMETERS: Statements - Number of statements to disassemble
- * Op - Current Op (from parse walk)
- *
- * RETURN: None
- *
- * DESCRIPTION: Display disassembled AML (ASL) starting from Op for the number
- * of statements specified.
- *
- ******************************************************************************/
-
-void
-acpi_db_disassemble_aml (
- NATIVE_CHAR *statements,
- acpi_parse_object *op)
-{
- u32 num_statements = 8;
-
-
- if (!op) {
- acpi_os_printf ("There is no method currently executing\n");
- return;
- }
-
- if (statements) {
- num_statements = ACPI_STRTOUL (statements, NULL, 0);
- }
-
- acpi_db_display_op (NULL, op, num_statements);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_db_dump_namespace
- *
- * PARAMETERS: Start_arg - Node to begin namespace dump
- * Depth_arg - Maximum tree depth to be dumped
- *
- * RETURN: None
- *
- * DESCRIPTION: Dump entire namespace or a subtree. Each node is displayed
- * with type and other information.
- *
- ******************************************************************************/
-
-void
-acpi_db_dump_namespace (
- NATIVE_CHAR *start_arg,
- NATIVE_CHAR *depth_arg)
-{
- acpi_handle subtree_entry = acpi_gbl_root_node;
- u32 max_depth = ACPI_UINT32_MAX;
-
-
- /* No argument given, just start at the root and dump entire namespace */
-
- if (start_arg) {
- /* Check if numeric argument, must be a Node */
-
- if ((start_arg[0] >= 0x30) && (start_arg[0] <= 0x39)) {
- subtree_entry = ACPI_TO_POINTER (ACPI_STRTOUL (start_arg, NULL, 16));
- if (!acpi_os_readable (subtree_entry, sizeof (acpi_namespace_node))) {
- acpi_os_printf ("Address %p is invalid in this address space\n", subtree_entry);
- return;
- }
-
- if (ACPI_GET_DESCRIPTOR_TYPE (subtree_entry) != ACPI_DESC_TYPE_NAMED) {
- acpi_os_printf ("Address %p is not a valid Named object\n", subtree_entry);
- return;
- }
- }
-
- /* Alpha argument */
-
- else {
- /* The parameter is a name string that must be resolved to a Named obj*/
-
- subtree_entry = acpi_db_local_ns_lookup (start_arg);
- if (!subtree_entry) {
- subtree_entry = acpi_gbl_root_node;
- }
- }
-
- /* Now we can check for the depth argument */
-
- if (depth_arg) {
- max_depth = ACPI_STRTOUL (depth_arg, NULL, 0);
- }
- }
-
- acpi_db_set_output_destination (ACPI_DB_DUPLICATE_OUTPUT);
- acpi_os_printf ("ACPI Namespace (from %p subtree):\n", subtree_entry);
-
- /* Display the subtree */
-
- acpi_db_set_output_destination (ACPI_DB_REDIRECTABLE_OUTPUT);
- acpi_ns_dump_objects (ACPI_TYPE_ANY, ACPI_DISPLAY_SUMMARY, max_depth, ACPI_UINT32_MAX, subtree_entry);
- acpi_db_set_output_destination (ACPI_DB_CONSOLE_OUTPUT);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_db_dump_namespace_by_owner
- *
- * PARAMETERS: Owner_arg - Owner ID whose nodes will be displayed
- * Depth_arg - Maximum tree depth to be dumped
- *
- * RETURN: None
- *
- * DESCRIPTION: Dump elements of the namespace that are owned by the Owner_id.
- *
- ******************************************************************************/
-
-void
-acpi_db_dump_namespace_by_owner (
- NATIVE_CHAR *owner_arg,
- NATIVE_CHAR *depth_arg)
-{
- acpi_handle subtree_entry = acpi_gbl_root_node;
- u32 max_depth = ACPI_UINT32_MAX;
- u16 owner_id;
-
-
- owner_id = (u16) ACPI_STRTOUL (owner_arg, NULL, 0);
-
- /* Now we can check for the depth argument */
-
- if (depth_arg) {
- max_depth = ACPI_STRTOUL (depth_arg, NULL, 0);
- }
-
- acpi_db_set_output_destination (ACPI_DB_DUPLICATE_OUTPUT);
- acpi_os_printf ("ACPI Namespace by owner %X:\n", owner_id);
-
- /* Display the subtree */
-
- acpi_db_set_output_destination (ACPI_DB_REDIRECTABLE_OUTPUT);
- acpi_ns_dump_objects (ACPI_TYPE_ANY, ACPI_DISPLAY_SUMMARY, max_depth, owner_id, subtree_entry);
- acpi_db_set_output_destination (ACPI_DB_CONSOLE_OUTPUT);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_db_send_notify
- *
- * PARAMETERS: Name - Name of ACPI object to send the notify to
- * Value - Value of the notify to send.
- *
- * RETURN: None
- *
- * DESCRIPTION: Send an ACPI notification. The value specified is sent to the
- * named object as an ACPI notify.
- *
- ******************************************************************************/
-
-void
-acpi_db_send_notify (
- NATIVE_CHAR *name,
- u32 value)
-{
- acpi_namespace_node *node;
- acpi_status status;
-
-
- /* Translate name to an Named object */
-
- node = acpi_db_local_ns_lookup (name);
- if (!node) {
- return;
- }
-
- /* Decode Named object type */
-
- switch (node->type) {
- case ACPI_TYPE_DEVICE:
- case ACPI_TYPE_THERMAL:
-
- /* Send the notify */
-
- status = acpi_ev_queue_notify_request (node, value);
- if (ACPI_FAILURE (status)) {
- acpi_os_printf ("Could not queue notify\n");
- }
- break;
-
- default:
- acpi_os_printf ("Named object is not a device or a thermal object\n");
- break;
- }
-
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_db_set_method_data
- *
- * PARAMETERS: Type_arg - L for local, A for argument
- * Index_arg - which one
- * Value_arg - Value to set.
- *
- * RETURN: None
- *
- * DESCRIPTION: Set a local or argument for the running control method.
- * NOTE: only object supported is Number.
- *
- ******************************************************************************/
-
-void
-acpi_db_set_method_data (
- NATIVE_CHAR *type_arg,
- NATIVE_CHAR *index_arg,
- NATIVE_CHAR *value_arg)
-{
- NATIVE_CHAR type;
- u32 index;
- u32 value;
- acpi_walk_state *walk_state;
- acpi_operand_object *obj_desc;
- acpi_status status;
-
-
- /* Validate Type_arg */
-
- ACPI_STRUPR (type_arg);
- type = type_arg[0];
- if ((type != 'L') &&
- (type != 'A')) {
- acpi_os_printf ("Invalid SET operand: %s\n", type_arg);
- return;
- }
-
- /* Get the index and value */
-
- index = ACPI_STRTOUL (index_arg, NULL, 16);
- value = ACPI_STRTOUL (value_arg, NULL, 16);
-
- walk_state = acpi_ds_get_current_walk_state (acpi_gbl_current_walk_list);
- if (!walk_state) {
- acpi_os_printf ("There is no method currently executing\n");
- return;
- }
-
-
- /* Create and initialize the new object */
-
- obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
- if (!obj_desc) {
- acpi_os_printf ("Could not create an internal object\n");
- return;
- }
-
- obj_desc->integer.value = value;
-
-
- /* Store the new object into the target */
-
- switch (type) {
- case 'A':
-
- /* Set a method argument */
-
- if (index > MTH_MAX_ARG) {
- acpi_os_printf ("Arg%d - Invalid argument name\n", index);
- return;
- }
-
- status = acpi_ds_store_object_to_local (AML_ARG_OP, index, obj_desc, walk_state);
- if (ACPI_FAILURE (status)) {
- return;
- }
-
- obj_desc = walk_state->arguments[index].object;
-
- acpi_os_printf ("Arg%d: ", index);
- acpi_db_display_internal_object (obj_desc, walk_state);
- break;
-
- case 'L':
-
- /* Set a method local */
-
- if (index > MTH_MAX_LOCAL) {
- acpi_os_printf ("Local%d - Invalid local variable name\n", index);
- return;
- }
-
- status = acpi_ds_store_object_to_local (AML_LOCAL_OP, index, obj_desc, walk_state);
- if (ACPI_FAILURE (status)) {
- return;
- }
-
- obj_desc = walk_state->local_variables[index].object;
-
- acpi_os_printf ("Local%d: ", index);
- acpi_db_display_internal_object (obj_desc, walk_state);
- break;
-
- default:
- break;
- }
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_db_walk_for_specific_objects
- *
- * PARAMETERS: Callback from Walk_namespace
- *
- * RETURN: Status
- *
- * DESCRIPTION: Display short info about objects in the namespace
- *
- ******************************************************************************/
-
-acpi_status
-acpi_db_walk_for_specific_objects (
- acpi_handle obj_handle,
- u32 nesting_level,
- void *context,
- void **return_value)
-{
- acpi_operand_object *obj_desc;
- acpi_status status;
- acpi_buffer buffer;
-
-
- obj_desc = acpi_ns_get_attached_object ((acpi_namespace_node *) obj_handle);
-
- /* Get and display the full pathname to this object */
-
- buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
- status = acpi_ns_handle_to_pathname (obj_handle, &buffer);
- if (ACPI_FAILURE (status)) {
- acpi_os_printf ("Could Not get pathname for object %p\n", obj_handle);
- return (AE_OK);
- }
-
- acpi_os_printf ("%32s", buffer.pointer);
- ACPI_MEM_FREE (buffer.pointer);
-
-
- /* Display short information about the object */
-
- if (obj_desc) {
- switch (obj_desc->common.type) {
- case ACPI_TYPE_METHOD:
- acpi_os_printf (" #Args %d Concurrency %X", obj_desc->method.param_count, obj_desc->method.concurrency);
- break;
-
- case ACPI_TYPE_INTEGER:
- acpi_os_printf (" Value %X", obj_desc->integer.value);
- break;
-
- case ACPI_TYPE_STRING:
- acpi_os_printf (" \"%s\"", obj_desc->string.pointer);
- break;
-
- case ACPI_TYPE_REGION:
- acpi_os_printf (" Space_id %X Address %X Length %X", obj_desc->region.space_id, obj_desc->region.address, obj_desc->region.length);
- break;
-
- case ACPI_TYPE_PACKAGE:
- acpi_os_printf (" #Elements %X", obj_desc->package.count);
- break;
-
- case ACPI_TYPE_BUFFER:
- acpi_os_printf (" Length %X", obj_desc->buffer.length);
- break;
-
- default:
- /* Ignore other object types */
- break;
- }
- }
-
- acpi_os_printf ("\n");
- return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_db_display_objects
- *
- * PARAMETERS: Obj_type_arg - Type of object to display
- * Display_count_arg - Max depth to display
- *
- * RETURN: None
- *
- * DESCRIPTION: Display objects in the namespace of the requested type
- *
- ******************************************************************************/
-
-acpi_status
-acpi_db_display_objects (
- NATIVE_CHAR *obj_type_arg,
- NATIVE_CHAR *display_count_arg)
-{
- acpi_object_type type;
-
-
- /* Get the object type */
-
- type = acpi_db_match_argument (obj_type_arg, acpi_db_object_types);
- if (type == ACPI_TYPE_NOT_FOUND) {
- acpi_os_printf ("Invalid or unsupported argument\n");
- return (AE_OK);
- }
-
- acpi_db_set_output_destination (ACPI_DB_DUPLICATE_OUTPUT);
- acpi_os_printf ("Objects of type [%s] defined in the current ACPI Namespace: \n", acpi_ut_get_type_name (type));
-
- acpi_db_set_output_destination (ACPI_DB_REDIRECTABLE_OUTPUT);
-
- /* Walk the namespace from the root */
-
- (void) acpi_walk_namespace (type, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
- acpi_db_walk_for_specific_objects, (void *) &type, NULL);
-
- acpi_db_set_output_destination (ACPI_DB_CONSOLE_OUTPUT);
- return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_db_walk_and_match_name
- *
- * PARAMETERS: Callback from Walk_namespace
- *
- * RETURN: Status
- *
- * DESCRIPTION: Find a particular name/names within the namespace. Wildcards
- * are supported -- '?' matches any character.
- *
- ******************************************************************************/
-
-acpi_status
-acpi_db_walk_and_match_name (
- acpi_handle obj_handle,
- u32 nesting_level,
- void *context,
- void **return_value)
-{
- acpi_status status;
- NATIVE_CHAR *requested_name = (NATIVE_CHAR *) context;
- u32 i;
- acpi_buffer buffer;
-
-
- /* Check for a name match */
-
- for (i = 0; i < 4; i++) {
- /* Wildcard support */
-
- if ((requested_name[i] != '?') &&
- (requested_name[i] != ((acpi_namespace_node *) obj_handle)->name.ascii[i])) {
- /* No match, just exit */
-
- return (AE_OK);
- }
- }
-
-
- /* Get the full pathname to this object */
-
- buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
- status = acpi_ns_handle_to_pathname (obj_handle, &buffer);
- if (ACPI_FAILURE (status)) {
- acpi_os_printf ("Could Not get pathname for object %p\n", obj_handle);
- }
- else {
- acpi_os_printf ("%32s (%p) - %s\n", buffer.pointer, obj_handle,
- acpi_ut_get_type_name (((acpi_namespace_node *) obj_handle)->type));
- ACPI_MEM_FREE (buffer.pointer);
- }
-
- return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_db_find_name_in_namespace
- *
- * PARAMETERS: Name_arg - The 4-character ACPI name to find.
- * wildcards are supported.
- *
- * RETURN: None
- *
- * DESCRIPTION: Search the namespace for a given name (with wildcards)
- *
- ******************************************************************************/
-
-acpi_status
-acpi_db_find_name_in_namespace (
- NATIVE_CHAR *name_arg)
-{
-
- if (ACPI_STRLEN (name_arg) > 4) {
- acpi_os_printf ("Name must be no longer than 4 characters\n");
- return (AE_OK);
- }
-
- /* Walk the namespace from the root */
-
- (void) acpi_walk_namespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
- acpi_db_walk_and_match_name, name_arg, NULL);
-
- acpi_db_set_output_destination (ACPI_DB_CONSOLE_OUTPUT);
- return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_db_set_scope
- *
- * PARAMETERS: Name - New scope path
- *
- * RETURN: Status
- *
- * DESCRIPTION: Set the "current scope" as maintained by this utility.
- * The scope is used as a prefix to ACPI paths.
- *
- ******************************************************************************/
-
-void
-acpi_db_set_scope (
- NATIVE_CHAR *name)
-{
- acpi_status status;
- acpi_namespace_node *node;
-
-
- if (!name || name[0] == 0) {
- acpi_os_printf ("Current scope: %s\n", acpi_gbl_db_scope_buf);
- return;
- }
-
- acpi_db_prep_namestring (name);
-
-
- if (name[0] == '\\') {
- /* Validate new scope from the root */
-
- status = acpi_ns_get_node_by_path (name, acpi_gbl_root_node, ACPI_NS_NO_UPSEARCH, &node);
- if (ACPI_FAILURE (status)) {
- goto error_exit;
- }
-
- ACPI_STRCPY (acpi_gbl_db_scope_buf, name);
- ACPI_STRCAT (acpi_gbl_db_scope_buf, "\\");
- }
- else {
- /* Validate new scope relative to old scope */
-
- status = acpi_ns_get_node_by_path (name, acpi_gbl_db_scope_node, ACPI_NS_NO_UPSEARCH, &node);
- if (ACPI_FAILURE (status)) {
- goto error_exit;
- }
-
- ACPI_STRCAT (acpi_gbl_db_scope_buf, name);
- ACPI_STRCAT (acpi_gbl_db_scope_buf, "\\");
- }
-
- acpi_gbl_db_scope_node = node;
- acpi_os_printf ("New scope: %s\n", acpi_gbl_db_scope_buf);
- return;
-
-
-error_exit:
-
- acpi_os_printf ("Could not attach scope: %s, %s\n", name, acpi_format_exception (status));
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_db_display_resources
- *
- * PARAMETERS: Object_arg - String with hex value of the object
- *
- * RETURN: None
- *
- * DESCRIPTION:
- *
- ******************************************************************************/
-
-void
-acpi_db_display_resources (
- NATIVE_CHAR *object_arg)
-{
-#if ACPI_MACHINE_WIDTH != 16
-
- acpi_operand_object *obj_desc;
- acpi_status status;
- acpi_buffer return_obj;
-
-
- acpi_db_set_output_destination (ACPI_DB_REDIRECTABLE_OUTPUT);
- acpi_dbg_level |= ACPI_LV_RESOURCES;
-
- /* Convert string to object pointer */
-
- obj_desc = ACPI_TO_POINTER (ACPI_STRTOUL (object_arg, NULL, 16));
-
- /* Prepare for a return object of arbitrary size */
-
- return_obj.pointer = acpi_gbl_db_buffer;
- return_obj.length = ACPI_DEBUG_BUFFER_SIZE;
-
- /* _PRT */
-
- acpi_os_printf ("Evaluating _PRT\n");
-
- status = acpi_evaluate_object (obj_desc, "_PRT", NULL, &return_obj);
- if (ACPI_FAILURE (status)) {
- acpi_os_printf ("Could not obtain _PRT: %s\n", acpi_format_exception (status));
- goto get_crs;
- }
-
- return_obj.pointer = acpi_gbl_db_buffer;
- return_obj.length = ACPI_DEBUG_BUFFER_SIZE;
-
- status = acpi_get_irq_routing_table (obj_desc, &return_obj);
- if (ACPI_FAILURE (status)) {
- acpi_os_printf ("Get_irq_routing_table failed: %s\n", acpi_format_exception (status));
- }
-
- else {
- acpi_rs_dump_irq_list ((u8 *) acpi_gbl_db_buffer);
- }
-
-
- /* _CRS */
-
-get_crs:
- acpi_os_printf ("Evaluating _CRS\n");
-
- return_obj.pointer = acpi_gbl_db_buffer;
- return_obj.length = ACPI_DEBUG_BUFFER_SIZE;
-
- status = acpi_evaluate_object (obj_desc, "_CRS", NULL, &return_obj);
- if (ACPI_FAILURE (status)) {
- acpi_os_printf ("Could not obtain _CRS: %s\n", acpi_format_exception (status));
- goto get_prs;
- }
-
- return_obj.pointer = acpi_gbl_db_buffer;
- return_obj.length = ACPI_DEBUG_BUFFER_SIZE;
-
- status = acpi_get_current_resources (obj_desc, &return_obj);
- if (ACPI_FAILURE (status)) {
- acpi_os_printf ("Acpi_get_current_resources failed: %s\n", acpi_format_exception (status));
- goto get_prs;
- }
-
- else {
- acpi_rs_dump_resource_list (ACPI_CAST_PTR (acpi_resource, acpi_gbl_db_buffer));
- }
-
- status = acpi_set_current_resources (obj_desc, &return_obj);
- if (ACPI_FAILURE (status)) {
- acpi_os_printf ("Acpi_set_current_resources failed: %s\n", acpi_format_exception (status));
- goto get_prs;
- }
-
-
- /* _PRS */
-
-get_prs:
- acpi_os_printf ("Evaluating _PRS\n");
-
- return_obj.pointer = acpi_gbl_db_buffer;
- return_obj.length = ACPI_DEBUG_BUFFER_SIZE;
-
- status = acpi_evaluate_object (obj_desc, "_PRS", NULL, &return_obj);
- if (ACPI_FAILURE (status)) {
- acpi_os_printf ("Could not obtain _PRS: %s\n", acpi_format_exception (status));
- goto cleanup;
- }
-
- return_obj.pointer = acpi_gbl_db_buffer;
- return_obj.length = ACPI_DEBUG_BUFFER_SIZE;
-
- status = acpi_get_possible_resources (obj_desc, &return_obj);
- if (ACPI_FAILURE (status)) {
- acpi_os_printf ("Acpi_get_possible_resources failed: %s\n", acpi_format_exception (status));
- }
-
- else {
- acpi_rs_dump_resource_list (ACPI_CAST_PTR (acpi_resource, acpi_gbl_db_buffer));
- }
-
-
-cleanup:
-
- acpi_db_set_output_destination (ACPI_DB_CONSOLE_OUTPUT);
- return;
-#endif
-
-}
-
-
-typedef struct
-{
- u32 nodes;
- u32 objects;
-} ACPI_INTEGRITY_INFO;
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_db_integrity_walk
- *
- * PARAMETERS: Callback from Walk_namespace
- *
- * RETURN: Status
- *
- * DESCRIPTION: Examine one NS node for valid values.
- *
- ******************************************************************************/
-
-acpi_status
-acpi_db_integrity_walk (
- acpi_handle obj_handle,
- u32 nesting_level,
- void *context,
- void **return_value)
-{
- ACPI_INTEGRITY_INFO *info = (ACPI_INTEGRITY_INFO *) context;
- acpi_namespace_node *node = (acpi_namespace_node *) obj_handle;
- acpi_operand_object *object;
-
-
- info->nodes++;
- if (ACPI_GET_DESCRIPTOR_TYPE (node) != ACPI_DESC_TYPE_NAMED) {
- acpi_os_printf ("Invalid Descriptor Type for Node %p, Type = %X\n",
- node, ACPI_GET_DESCRIPTOR_TYPE (node));
- }
-
- if (node->type > INTERNAL_TYPE_MAX) {
- acpi_os_printf ("Invalid Object Type for Node %p, Type = %X\n",
- node, node->type);
- }
-
- if (!acpi_ut_valid_acpi_name (node->name.integer)) {
- acpi_os_printf ("Invalid Acpi_name for Node %p\n", node);
- }
-
- object = acpi_ns_get_attached_object (node);
- if (object) {
- info->objects++;
- if (ACPI_GET_DESCRIPTOR_TYPE (object) != ACPI_DESC_TYPE_OPERAND) {
- acpi_os_printf ("Invalid Descriptor Type for Object %p, Type = %X\n",
- object, ACPI_GET_DESCRIPTOR_TYPE (object));
- }
- }
-
-
- return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_db_check_integrity
- *
- * PARAMETERS: None
- *
- * RETURN: None
- *
- * DESCRIPTION: Check entire namespace for data structure integrity
- *
- ******************************************************************************/
-
-void
-acpi_db_check_integrity (void)
-{
- ACPI_INTEGRITY_INFO info = {0,0};
-
- /* Search all nodes in namespace */
-
- (void) acpi_walk_namespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
- acpi_db_integrity_walk, (void *) &info, NULL);
-
- acpi_os_printf ("Verified %d namespace nodes with %d Objects\n", info.nodes, info.objects);
-
-}
-
-#endif /* ENABLE_DEBUGGER */
diff -Nru a/drivers/acpi/debugger/dbdisasm.c b/drivers/acpi/debugger/dbdisasm.c
--- a/drivers/acpi/debugger/dbdisasm.c Wed Oct 8 09:05:45 2003
+++ /dev/null Wed Dec 31 16:00:00 1969
@@ -1,706 +0,0 @@
-/*******************************************************************************
- *
- * Module Name: dbdisasm - parser op tree display routines
- * $Revision: 66 $
- *
- ******************************************************************************/
-
-/*
- * Copyright (C) 2000 - 2002, R. Byron Moore
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-
-#include "acpi.h"
-#include "acparser.h"
-#include "amlcode.h"
-#include "acnamesp.h"
-#include "acdebug.h"
-
-
-#ifdef ENABLE_DEBUGGER
-
-#define _COMPONENT ACPI_DEBUGGER
- ACPI_MODULE_NAME ("dbdisasm")
-
-
-#define BLOCK_PAREN 1
-#define BLOCK_BRACE 2
-#define DB_NO_OP_INFO " [%2.2d] "
-#define DB_FULL_OP_INFO "%5.5X #%4.4hX [%2.2d] "
-
-
-NATIVE_CHAR *acpi_gbl_db_disasm_indent = "....";
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_db_block_type
- *
- * PARAMETERS: Op - Object to be examined
- *
- * RETURN: Status
- *
- * DESCRIPTION: Type of block for this op (parens or braces)
- *
- ******************************************************************************/
-
-u32
-acpi_db_block_type (
- acpi_parse_object *op)
-{
-
- switch (op->common.aml_opcode) {
- case AML_METHOD_OP:
- return (BLOCK_BRACE);
-
- default:
- break;
- }
-
- return (BLOCK_PAREN);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_ps_display_object_pathname
- *
- * PARAMETERS: Op - Object whose pathname is to be obtained
- *
- * RETURN: Status
- *
- * DESCRIPTION: Diplay the pathname associated with a named object. Two
- * versions. One searches the parse tree (for parser-only
- * applications suchas Acpi_dump), and the other searches the
- * ACPI namespace (the parse tree is probably deleted)
- *
- ******************************************************************************/
-
-#ifdef PARSER_ONLY
-
-acpi_status
-acpi_ps_display_object_pathname (
- acpi_walk_state *walk_state,
- acpi_parse_object *op)
-{
- acpi_parse_object *target_op;
- char *name;
-
-
- if (op->common.flags & ACPI_PARSEOP_GENERIC) {
- name = op->common.value.name;
- if (name[0] == '\\') {
- acpi_os_printf (" (Fully Qualified Pathname)");
- return (AE_OK);
- }
- }
- else {
- name = (char *) &op->named.name;
- }
-
- /* Search parent tree up to the root if necessary */
-
- target_op = acpi_ps_find (op, name, 0, 0);
- if (!target_op) {
- /*
- * Didn't find the name in the parse tree. This may be
- * a problem, or it may simply be one of the predefined names
- * (such as _OS_). Rather than worry about looking up all
- * the predefined names, just display the name as given
- */
- acpi_os_printf (" **** Path not found in parse tree");
- }
- else {
- /* The target was found, print the name and complete path */
-
- acpi_os_printf (" (Path ");
- acpi_db_display_path (target_op);
- acpi_os_printf (")");
- }
-
- return (AE_OK);
-}
-
-#else
-
-acpi_status
-acpi_ps_display_object_pathname (
- acpi_walk_state *walk_state,
- acpi_parse_object *op)
-{
- acpi_status status;
- acpi_namespace_node *node;
- acpi_buffer buffer;
- u32 debug_level;
-
-
- /* Save current debug level so we don't get extraneous debug output */
-
- debug_level = acpi_dbg_level;
- acpi_dbg_level = 0;
-
- /* Just get the Node out of the Op object */
-
- node = op->common.node;
- if (!node) {
- /* Node not defined in this scope, look it up */
-
- status = acpi_ns_lookup (walk_state->scope_info, op->common.value.string, ACPI_TYPE_ANY,
- ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, walk_state, &(node));
-
- if (ACPI_FAILURE (status)) {
- /*
- * We can't get the pathname since the object
- * is not in the namespace. This can happen during single
- * stepping where a dynamic named object is *about* to be created.
- */
- acpi_os_printf (" [Path not found]");
- goto exit;
- }
-
- /* Save it for next time. */
-
- op->common.node = node;
- }
-
- /* Convert Named_desc/handle to a full pathname */
-
- buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
- status = acpi_ns_handle_to_pathname (node, &buffer);
- if (ACPI_FAILURE (status)) {
- acpi_os_printf ("****Could not get pathname****)");
- goto exit;
- }
-
- acpi_os_printf (" (Path %s)", buffer.pointer);
- ACPI_MEM_FREE (buffer.pointer);
-
-
-exit:
- /* Restore the debug level */
-
- acpi_dbg_level = debug_level;
- return (status);
-}
-
-#endif
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_db_display_op
- *
- * PARAMETERS: Origin - Starting object
- * Num_opcodes - Max number of opcodes to be displayed
- *
- * RETURN: None
- *
- * DESCRIPTION: Display parser object and its children
- *
- ******************************************************************************/
-
-void
-acpi_db_display_op (
- acpi_walk_state *walk_state,
- acpi_parse_object *origin,
- u32 num_opcodes)
-{
- acpi_parse_object *op = origin;
- acpi_parse_object *arg;
- acpi_parse_object *depth;
- u32 depth_count = 0;
- u32 last_depth = 0;
- u32 i;
- u32 j;
-
-
- if (!op) {
- acpi_db_display_opcode (walk_state, op);
- return;
- }
-
-
- while (op) {
- /* Indentation */
-
- depth_count = 0;
- if (!acpi_gbl_db_opt_verbose) {
- depth_count++;
- }
-
- /* Determine the nesting depth of this argument */
-
- for (depth = op->common.parent; depth; depth = depth->common.parent) {
- arg = acpi_ps_get_arg (depth, 0);
- while (arg && arg != origin) {
- arg = arg->common.next;
- }
-
- if (arg) {
- break;
- }
-
- depth_count++;
- }
-
- /* Open a new block if we are nested further than last time */
-
- if (depth_count > last_depth) {
- VERBOSE_PRINT ((DB_NO_OP_INFO, last_depth));
- for (i = 0; i < last_depth; i++) {
- acpi_os_printf ("%s", acpi_gbl_db_disasm_indent);
- }
-
- if (acpi_db_block_type (op) == BLOCK_PAREN) {
- acpi_os_printf ("(\n");
- }
- else {
- acpi_os_printf ("{\n");
- }
- }
-
- /* Close a block if we are nested less than last time */
-
- else if (depth_count < last_depth) {
- for (j = last_depth; j >= (depth_count + 1); j--) {
- VERBOSE_PRINT ((DB_NO_OP_INFO, (j - 1)));
- for (i = 1; i < j; i++) {
- acpi_os_printf ("%s", acpi_gbl_db_disasm_indent);
- }
-
- if (acpi_db_block_type (op) == BLOCK_PAREN) {
- acpi_os_printf (")\n");
- }
- else {
- acpi_os_printf ("}\n");
- }
- }
- }
-
- /* In verbose mode, print the AML offset, opcode and depth count */
-
- VERBOSE_PRINT ((DB_FULL_OP_INFO, (u32) op->common.aml_offset,
- op->common.aml_opcode, depth_count));
-
-
- /* Indent the output according to the depth count */
-
- for (i = 0; i < depth_count; i++) {
- acpi_os_printf ("%s", acpi_gbl_db_disasm_indent);
- }
-
- /* Now print the opcode */
-
- acpi_db_display_opcode (walk_state, op);
-
- /* Resolve a name reference */
-
- if ((op->common.aml_opcode == AML_INT_NAMEPATH_OP && op->common.value.name) &&
- (op->common.parent) &&
- (acpi_gbl_db_opt_verbose)) {
- (void) acpi_ps_display_object_pathname (walk_state, op);
- }
-
- acpi_os_printf ("\n");
-
- /* Get the next node in the tree */
-
- op = acpi_ps_get_depth_next (origin, op);
- last_depth = depth_count;
-
- num_opcodes--;
- if (!num_opcodes) {
- op = NULL;
- }
- }
-
- /* Close the last block(s) */
-
- depth_count = last_depth -1;
- for (i = 0; i < last_depth; i++) {
- VERBOSE_PRINT ((DB_NO_OP_INFO, last_depth - i));
- for (j = 0; j < depth_count; j++) {
- acpi_os_printf ("%s", acpi_gbl_db_disasm_indent);
- }
- acpi_os_printf ("}\n");
- depth_count--;
- }
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_db_display_namestring
- *
- * PARAMETERS: Name - ACPI Name string to store
- *
- * RETURN: None
- *
- * DESCRIPTION: Display namestring. Handles prefix characters
- *
- ******************************************************************************/
-
-void
-acpi_db_display_namestring (
- NATIVE_CHAR *name)
-{
- u32 seg_count;
-
-
- if (!name) {
- acpi_os_printf ("");
- return;
- }
-
- /* Handle all Scope Prefix operators */
-
- while (acpi_ps_is_prefix_char (ACPI_GET8 (name))) {
- /* Append prefix character */
-
- acpi_os_printf ("%1c", ACPI_GET8 (name));
- name++;
- }
-
- switch (ACPI_GET8 (name)) {
- case 0:
- seg_count = 0;
- break;
-
- case AML_DUAL_NAME_PREFIX:
- seg_count = 2;
- name++;
- break;
-
- case AML_MULTI_NAME_PREFIX_OP:
- seg_count = (u32) ACPI_GET8 (name + 1);
- name += 2;
- break;
-
- default:
- seg_count = 1;
- break;
- }
-
- while (seg_count) {
- /* Append Name segment */
-
- acpi_os_printf ("%4.4s", name);
-
- seg_count--;
- if (seg_count) {
- /* Not last name, append dot separator */
-
- acpi_os_printf (".");
- }
- name += ACPI_NAME_SIZE;
- }
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_db_display_path
- *
- * PARAMETERS: Op - Named Op whose path is to be constructed
- *
- * RETURN: None
- *
- * DESCRIPTION: Walk backwards from current scope and display the name
- * of each previous level of scope up to the root scope
- * (like "pwd" does with file systems)
- *
- ******************************************************************************/
-
-void
-acpi_db_display_path (
- acpi_parse_object *op)
-{
- acpi_parse_object *prev;
- acpi_parse_object *search;
- u32 name;
- u8 do_dot = FALSE;
- acpi_parse_object *name_path;
- const acpi_opcode_info *op_info;
-
-
- /* We are only interested in named objects */
-
- op_info = acpi_ps_get_opcode_info (op->common.aml_opcode);
- if (!(op_info->flags & AML_NSNODE)) {
- return;
- }
-
- if (op_info->flags & AML_CREATE) {
- /* Field creation - check for a fully qualified namepath */
-
- if (op->common.aml_opcode == AML_CREATE_FIELD_OP) {
- name_path = acpi_ps_get_arg (op, 3);
- }
- else {
- name_path = acpi_ps_get_arg (op, 2);
- }
-
- if ((name_path) &&
- (name_path->common.value.string) &&
- (name_path->common.value.string[0] == '\\')) {
- acpi_db_display_namestring (name_path->common.value.string);
- return;
- }
- }
-
- prev = NULL; /* Start with Root Node */
-
- while (prev != op) {
- /* Search upwards in the tree to find scope with "prev" as its parent */
-
- search = op;
- for (; ;) {
- if (search->common.parent == prev) {
- break;
- }
-
- /* Go up one level */
-
- search = search->common.parent;
- }
-
- if (prev) {
- op_info = acpi_ps_get_opcode_info (search->common.aml_opcode);
- if (!(op_info->flags & AML_FIELD)) {
- /* below root scope, append scope name */
-
- if (do_dot) {
- /* append dot */
-
- acpi_os_printf (".");
- }
-
- if (op_info->flags & AML_CREATE) {
- if (op->common.aml_opcode == AML_CREATE_FIELD_OP) {
- name_path = acpi_ps_get_arg (op, 3);
- }
- else {
- name_path = acpi_ps_get_arg (op, 2);
- }
-
- if ((name_path) &&
- (name_path->common.value.string)) {
- acpi_os_printf ("%4.4s", name_path->common.value.string);
- }
- }
- else {
- name = acpi_ps_get_name (search);
- acpi_os_printf ("%4.4s", &name);
- }
-
- do_dot = TRUE;
- }
- }
-
- prev = search;
- }
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_db_display_opcode
- *
- * PARAMETERS: Op - Op that is to be printed
- *
- * RETURN: Status
- *
- * DESCRIPTION: Store printed op in a Buffer and return its length
- * (or -1 if out of space)
- *
- * NOTE: Terse mode prints out ASL-like code. Verbose mode adds more info.
- *
- ******************************************************************************/
-
-void
-acpi_db_display_opcode (
- acpi_walk_state *walk_state,
- acpi_parse_object *op)
-{
- u8 *byte_data;
- u32 byte_count;
- u32 i;
- const acpi_opcode_info *op_info = NULL;
- u32 name;
-
-
- if (!op) {
- acpi_os_printf ("");
- return;
- }
-
- /* op and arguments */
-
- switch (op->common.aml_opcode) {
- case AML_BYTE_OP:
-
- if (acpi_gbl_db_opt_verbose) {
- acpi_os_printf ("(u8) 0x%2.2hX", op->common.value.integer8);
- }
- else {
- acpi_os_printf ("0x%2.2hX", op->common.value.integer8);
- }
- break;
-
-
- case AML_WORD_OP:
-
- if (acpi_gbl_db_opt_verbose) {
- acpi_os_printf ("(u16) 0x%4.4hX", op->common.value.integer16);
- }
- else {
- acpi_os_printf ("0x%4.4hX", op->common.value.integer16);
- }
- break;
-
-
- case AML_DWORD_OP:
-
- if (acpi_gbl_db_opt_verbose) {
- acpi_os_printf ("(u32) 0x%8.8X", op->common.value.integer32);
- }
- else {
- acpi_os_printf ("0x%8.8X", op->common.value.integer32);
- }
- break;
-
-
- case AML_QWORD_OP:
-
- if (acpi_gbl_db_opt_verbose) {
- acpi_os_printf ("(u64) 0x%8.8X%8.8X", op->common.value.integer64.hi,
- op->common.value.integer64.lo);
- }
- else {
- acpi_os_printf ("0x%8.8X%8.8X", op->common.value.integer64.hi,
- op->common.value.integer64.lo);
- }
- break;
-
-
- case AML_STRING_OP:
-
- if (op->common.value.string) {
- acpi_os_printf ("\"%s\"", op->common.value.string);
- }
- else {
- acpi_os_printf ("<\"NULL STRING PTR\">");
- }
- break;
-
-
- case AML_INT_STATICSTRING_OP:
-
- if (op->common.value.string) {
- acpi_os_printf ("\"%s\"", op->common.value.string);
- }
- else {
- acpi_os_printf ("\"\"");
- }
- break;
-
-
- case AML_INT_NAMEPATH_OP:
-
- acpi_db_display_namestring (op->common.value.name);
- break;
-
-
- case AML_INT_NAMEDFIELD_OP:
-
- acpi_os_printf ("Named_field (Length 0x%8.8X) ", op->common.value.integer32);
- break;
-
-
- case AML_INT_RESERVEDFIELD_OP:
-
- acpi_os_printf ("Reserved_field (Length 0x%8.8X) ", op->common.value.integer32);
- break;
-
-
- case AML_INT_ACCESSFIELD_OP:
-
- acpi_os_printf ("Access_field (Length 0x%8.8X) ", op->common.value.integer32);
- break;
-
-
- case AML_INT_BYTELIST_OP:
-
- if (acpi_gbl_db_opt_verbose) {
- acpi_os_printf ("Byte_list (Length 0x%8.8X) ", op->common.value.integer32);
- }
- else {
- acpi_os_printf ("0x%2.2X", op->common.value.integer32);
-
- byte_count = op->common.value.integer32;
- byte_data = op->named.data;
-
- for (i = 0; i < byte_count; i++) {
- acpi_os_printf (", 0x%2.2X", byte_data[i]);
- }
- }
- break;
-
-
- default:
-
- /* Just get the opcode name and print it */
-
- op_info = acpi_ps_get_opcode_info (op->common.aml_opcode);
- acpi_os_printf ("%s", op_info->name);
-
-
-#ifndef PARSER_ONLY
- if ((op->common.aml_opcode == AML_INT_RETURN_VALUE_OP) &&
- (walk_state) &&
- (walk_state->results) &&
- (walk_state->results->results.num_results)) {
- acpi_db_decode_internal_object (walk_state->results->results.obj_desc [walk_state->results->results.num_results-1]);
- }
-#endif
- break;
- }
-
- if (!op_info) {
- /* If there is another element in the list, add a comma */
-
- if (op->common.next) {
- acpi_os_printf (",");
- }
- }
-
- /*
- * If this is a named opcode, print the associated name value
- */
- op_info = acpi_ps_get_opcode_info (op->common.aml_opcode);
- if (op && (op_info->flags & AML_NAMED)) {
- name = acpi_ps_get_name (op);
- acpi_os_printf (" %4.4s", &name);
-
- if ((acpi_gbl_db_opt_verbose) && (op->common.aml_opcode != AML_INT_NAMEDFIELD_OP)) {
- (void) acpi_ps_display_object_pathname (walk_state, op);
- }
- }
-}
-
-#endif /* ENABLE_DEBUGGER */
-
diff -Nru a/drivers/acpi/debugger/dbdisply.c b/drivers/acpi/debugger/dbdisply.c
--- a/drivers/acpi/debugger/dbdisply.c Wed Oct 8 09:05:45 2003
+++ /dev/null Wed Dec 31 16:00:00 1969
@@ -1,813 +0,0 @@
-/*******************************************************************************
- *
- * Module Name: dbdisply - debug display commands
- * $Revision: 73 $
- *
- ******************************************************************************/
-
-/*
- * Copyright (C) 2000 - 2002, R. Byron Moore
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-
-#include "acpi.h"
-#include "amlcode.h"
-#include "acdispat.h"
-#include "acnamesp.h"
-#include "acparser.h"
-#include "acinterp.h"
-#include "acdebug.h"
-
-
-#ifdef ENABLE_DEBUGGER
-
-
-#define _COMPONENT ACPI_DEBUGGER
- ACPI_MODULE_NAME ("dbdisply")
-
-
-/******************************************************************************
- *
- * FUNCTION: Acpi_db_get_pointer
- *
- * PARAMETERS: Target - Pointer to string to be converted
- *
- * RETURN: Converted pointer
- *
- * DESCRIPTION: Convert an ascii pointer value to a real value
- *
- *****************************************************************************/
-
-void *
-acpi_db_get_pointer (
- void *target)
-{
- void *obj_ptr;
-
-
-#if ACPI_MACHINE_WIDTH == 16
-#include
-
- /* Have to handle 16-bit pointers of the form segment:offset */
-
- if (!sscanf (target, "%p", &obj_ptr)) {
- acpi_os_printf ("Invalid pointer: %s\n", target);
- return (NULL);
- }
-
-#else
-
- /* Simple flat pointer */
-
- obj_ptr = ACPI_TO_POINTER (ACPI_STRTOUL (target, NULL, 16));
-#endif
-
- return (obj_ptr);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_db_dump_parser_descriptor
- *
- * PARAMETERS: Op - A parser Op descriptor
- *
- * RETURN: None
- *
- * DESCRIPTION: Display a formatted parser object
- *
- ******************************************************************************/
-
-void
-acpi_db_dump_parser_descriptor (
- acpi_parse_object *op)
-{
- const acpi_opcode_info *info;
-
-
- info = acpi_ps_get_opcode_info (op->common.aml_opcode);
-
- acpi_os_printf ("Parser Op Descriptor:\n");
- acpi_os_printf ("%20.20s : %4.4X\n", "Opcode", op->common.aml_opcode);
-
- ACPI_DEBUG_ONLY_MEMBERS (acpi_os_printf ("%20.20s : %s\n", "Opcode Name", info->name));
-
- acpi_os_printf ("%20.20s : %p\n", "Value/Arg_list", op->common.value.arg);
- acpi_os_printf ("%20.20s : %p\n", "Parent", op->common.parent);
- acpi_os_printf ("%20.20s : %p\n", "Next_op", op->common.next);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_db_decode_and_display_object
- *
- * PARAMETERS: Target - String with object to be displayed. Names
- * and hex pointers are supported.
- * Output_type - Byte, Word, Dword, or Qword (B|W|D|Q)
- *
- * RETURN: None
- *
- * DESCRIPTION: Display a formatted ACPI object
- *
- ******************************************************************************/
-
-void
-acpi_db_decode_and_display_object (
- NATIVE_CHAR *target,
- NATIVE_CHAR *output_type)
-{
- void *obj_ptr;
- acpi_namespace_node *node;
- acpi_operand_object *obj_desc;
- u32 display = DB_BYTE_DISPLAY;
- NATIVE_CHAR buffer[80];
- acpi_buffer ret_buf;
- acpi_status status;
- u32 size;
-
-
- if (!target) {
- return;
- }
-
- /* Decode the output type */
-
- if (output_type) {
- ACPI_STRUPR (output_type);
- if (output_type[0] == 'W') {
- display = DB_WORD_DISPLAY;
- }
- else if (output_type[0] == 'D') {
- display = DB_DWORD_DISPLAY;
- }
- else if (output_type[0] == 'Q') {
- display = DB_QWORD_DISPLAY;
- }
- }
-
- ret_buf.length = sizeof (buffer);
- ret_buf.pointer = buffer;
-
- /* Differentiate between a number and a name */
-
- if ((target[0] >= 0x30) && (target[0] <= 0x39)) {
- obj_ptr = acpi_db_get_pointer (target);
- if (!acpi_os_readable (obj_ptr, 16)) {
- acpi_os_printf ("Address %p is invalid in this address space\n", obj_ptr);
- return;
- }
-
- /* Decode the object type */
-
- switch (ACPI_GET_DESCRIPTOR_TYPE (obj_ptr)) {
- case ACPI_DESC_TYPE_NAMED:
-
- /* This is a namespace Node */
-
- if (!acpi_os_readable (obj_ptr, sizeof (acpi_namespace_node))) {
- acpi_os_printf ("Cannot read entire Named object at address %p\n", obj_ptr);
- return;
- }
-
- node = obj_ptr;
- goto dump_nte;
-
-
- case ACPI_DESC_TYPE_OPERAND:
-
- /* This is a ACPI OPERAND OBJECT */
-
- if (!acpi_os_readable (obj_ptr, sizeof (acpi_operand_object))) {
- acpi_os_printf ("Cannot read entire ACPI object at address %p\n", obj_ptr);
- return;
- }
-
- acpi_ut_dump_buffer (obj_ptr, sizeof (acpi_operand_object), display, ACPI_UINT32_MAX);
- acpi_ex_dump_object_descriptor (obj_ptr, 1);
- break;
-
-
- case ACPI_DESC_TYPE_PARSER:
-
- /* This is a Parser Op object */
-
- if (!acpi_os_readable (obj_ptr, sizeof (acpi_parse_object))) {
- acpi_os_printf ("Cannot read entire Parser object at address %p\n", obj_ptr);
- return;
- }
-
- acpi_ut_dump_buffer (obj_ptr, sizeof (acpi_parse_object), display, ACPI_UINT32_MAX);
- acpi_db_dump_parser_descriptor ((acpi_parse_object *) obj_ptr);
- break;
-
-
- default:
-
- /* Is not a recognizeable object */
-
- size = 16;
- if (acpi_os_readable (obj_ptr, 64)) {
- size = 64;
- }
-
- /* Just dump some memory */
-
- acpi_ut_dump_buffer (obj_ptr, size, display, ACPI_UINT32_MAX);
- break;
- }
-
- return;
- }
-
- /* The parameter is a name string that must be resolved to a Named obj */
-
- node = acpi_db_local_ns_lookup (target);
- if (!node) {
- return;
- }
-
-
-dump_nte:
- /* Now dump the Named obj */
-
- status = acpi_get_name (node, ACPI_FULL_PATHNAME, &ret_buf);
- if (ACPI_FAILURE (status)) {
- acpi_os_printf ("Could not convert name to pathname\n");
- }
-
- else {
- acpi_os_printf ("Object (%p) Pathname: %s\n", node, ret_buf.pointer);
- }
-
- if (!acpi_os_readable (node, sizeof (acpi_namespace_node))) {
- acpi_os_printf ("Invalid Named object at address %p\n", node);
- return;
- }
-
- acpi_ut_dump_buffer ((void *) node, sizeof (acpi_namespace_node), display, ACPI_UINT32_MAX);
- acpi_ex_dump_node (node, 1);
-
- obj_desc = acpi_ns_get_attached_object (node);
- if (obj_desc) {
- acpi_os_printf ("\n_attached Object (%p):\n", obj_desc);
- if (!acpi_os_readable (obj_desc, sizeof (acpi_operand_object))) {
- acpi_os_printf ("Invalid internal ACPI Object at address %p\n", obj_desc);
- return;
- }
-
- acpi_ut_dump_buffer ((void *) obj_desc, sizeof (acpi_operand_object), display, ACPI_UINT32_MAX);
- acpi_ex_dump_object_descriptor (obj_desc, 1);
- }
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_db_decode_internal_object
- *
- * PARAMETERS: Obj_desc - Object to be displayed
- *
- * RETURN: None
- *
- * DESCRIPTION: Short display of an internal object. Numbers and Strings.
- *
- ******************************************************************************/
-
-void
-acpi_db_decode_internal_object (
- acpi_operand_object *obj_desc)
-{
- u32 i;
-
-
- if (!obj_desc) {
- acpi_os_printf (" Uninitialized\n");
- return;
- }
-
- acpi_os_printf (" %s", acpi_ut_get_type_name (obj_desc->common.type));
-
- switch (obj_desc->common.type) {
- case ACPI_TYPE_INTEGER:
-
- acpi_os_printf (" %8.8X%8.8X", ACPI_HIDWORD (obj_desc->integer.value),
- ACPI_LODWORD (obj_desc->integer.value));
- break;
-
-
- case ACPI_TYPE_STRING:
-
- acpi_os_printf ("(%d) \"%.24s",
- obj_desc->string.length, obj_desc->string.pointer);
-
- if (obj_desc->string.length > 24)
- {
- acpi_os_printf ("...");
- }
- else
- {
- acpi_os_printf ("\"");
- }
- break;
-
-
- case ACPI_TYPE_BUFFER:
-
- acpi_os_printf ("(%d)", obj_desc->buffer.length);
- for (i = 0; (i < 8) && (i < obj_desc->buffer.length); i++) {
- acpi_os_printf (" %2.2X", obj_desc->buffer.pointer[i]);
- }
- break;
-
-
- default:
- /* No additional display for other types */
- break;
- }
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_db_display_internal_object
- *
- * PARAMETERS: Obj_desc - Object to be displayed
- * Walk_state - Current walk state
- *
- * RETURN: None
- *
- * DESCRIPTION: Short display of an internal object
- *
- ******************************************************************************/
-
-void
-acpi_db_display_internal_object (
- acpi_operand_object *obj_desc,
- acpi_walk_state *walk_state)
-{
- u8 type;
-
-
- acpi_os_printf ("%p ", obj_desc);
-
- if (!obj_desc) {
- acpi_os_printf ("\n");
- return;
- }
-
- /* Decode the object type */
-
- switch (ACPI_GET_DESCRIPTOR_TYPE (obj_desc)) {
- case ACPI_DESC_TYPE_PARSER:
-
- acpi_os_printf (" ");
- break;
-
-
- case ACPI_DESC_TYPE_NAMED:
-
- acpi_os_printf (" Name %4.4s Type-%s",
- ((acpi_namespace_node *)obj_desc)->name.ascii,
- acpi_ut_get_type_name (((acpi_namespace_node *) obj_desc)->type));
-
- if (((acpi_namespace_node *) obj_desc)->flags & ANOBJ_METHOD_ARG) {
- acpi_os_printf (" [Method Arg]");
- }
- if (((acpi_namespace_node *) obj_desc)->flags & ANOBJ_METHOD_LOCAL) {
- acpi_os_printf (" [Method Local]");
- }
- break;
-
-
- case ACPI_DESC_TYPE_OPERAND:
-
- type = obj_desc->common.type;
- if (type > INTERNAL_TYPE_MAX) {
- acpi_os_printf (" Type %hX [Invalid Type]", type);
- return;
- }
-
- /* Decode the ACPI object type */
-
- switch (obj_desc->common.type) {
- case INTERNAL_TYPE_REFERENCE:
- switch (obj_desc->reference.opcode) {
- case AML_ZERO_OP:
- acpi_os_printf ("[Const] Zero (0) [Null Target]", 0);
- break;
-
- case AML_ONES_OP:
- acpi_os_printf ("[Const] Ones (0xFFFFFFFFFFFFFFFF) [No Limit]");
- break;
-
- case AML_ONE_OP:
- acpi_os_printf ("[Const] One (1)");
- break;
-
- case AML_REVISION_OP:
- acpi_os_printf ("[Const] Revision (%X)", ACPI_CA_SUPPORT_LEVEL);
- break;
-
- case AML_LOCAL_OP:
- acpi_os_printf ("[Local%d] ", obj_desc->reference.offset);
- if (walk_state) {
- obj_desc = walk_state->local_variables[obj_desc->reference.offset].object;
- acpi_os_printf ("%p", obj_desc);
- acpi_db_decode_internal_object (obj_desc);
- }
- break;
-
- case AML_ARG_OP:
- acpi_os_printf ("[Arg%d] ", obj_desc->reference.offset);
- if (walk_state) {
- obj_desc = walk_state->arguments[obj_desc->reference.offset].object;
- acpi_os_printf ("%p", obj_desc);
- acpi_db_decode_internal_object (obj_desc);
- }
- break;
-
- case AML_DEBUG_OP:
- acpi_os_printf ("[Debug] ");
- break;
-
- case AML_INDEX_OP:
- acpi_os_printf ("[Index] ");
- acpi_db_decode_internal_object (obj_desc->reference.object);
- break;
-
- default:
- break;
-
- }
- break;
-
- default:
- acpi_os_printf (" ");
- acpi_os_printf (" ");
- acpi_db_decode_internal_object (obj_desc);
- break;
- }
- break;
-
-
- default:
-
- acpi_os_printf (" ");
- break;
- }
-
- acpi_os_printf ("\n");
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_db_display_method_info
- *
- * PARAMETERS: Start_op - Root of the control method parse tree
- *
- * RETURN: None
- *
- * DESCRIPTION: Display information about the current method
- *
- ******************************************************************************/
-
-void
-acpi_db_display_method_info (
- acpi_parse_object *start_op)
-{
- acpi_walk_state *walk_state;
- acpi_operand_object *obj_desc;
- acpi_namespace_node *node;
- acpi_parse_object *root_op;
- acpi_parse_object *op;
- const acpi_opcode_info *op_info;
- u32 num_ops = 0;
- u32 num_operands = 0;
- u32 num_operators = 0;
- u32 num_remaining_ops = 0;
- u32 num_remaining_operands = 0;
- u32 num_remaining_operators = 0;
- u32 num_args;
- u32 concurrency;
- u8 count_remaining = FALSE;
-
-
- walk_state = acpi_ds_get_current_walk_state (acpi_gbl_current_walk_list);
- if (!walk_state) {
- acpi_os_printf ("There is no method currently executing\n");
- return;
- }
-
- obj_desc = walk_state->method_desc;
- node = walk_state->method_node;
-
- num_args = obj_desc->method.param_count;
- concurrency = obj_desc->method.concurrency;
-
- acpi_os_printf ("Currently executing control method is [%4.4s]\n", node->name.ascii);
- acpi_os_printf ("%X arguments, max concurrency = %X\n", num_args, concurrency);
-
-
- root_op = start_op;
- while (root_op->common.parent) {
- root_op = root_op->common.parent;
- }
-
- op = root_op;
-
- while (op) {
- if (op == start_op) {
- count_remaining = TRUE;
- }
-
- num_ops++;
- if (count_remaining) {
- num_remaining_ops++;
- }
-
- /* Decode the opcode */
-
- op_info = acpi_ps_get_opcode_info (op->common.aml_opcode);
- switch (op_info->class) {
- case AML_CLASS_ARGUMENT:
- if (count_remaining) {
- num_remaining_operands++;
- }
-
- num_operands++;
- break;
-
- case AML_CLASS_UNKNOWN:
- /* Bad opcode or ASCII character */
-
- continue;
-
- default:
- if (count_remaining) {
- num_remaining_operators++;
- }
-
- num_operators++;
- break;
- }
-
- op = acpi_ps_get_depth_next (start_op, op);
- }
-
- acpi_os_printf ("Method contains: %X AML Opcodes - %X Operators, %X Operands\n",
- num_ops, num_operators, num_operands);
-
- acpi_os_printf ("Remaining to execute: %X AML Opcodes - %X Operators, %X Operands\n",
- num_remaining_ops, num_remaining_operators, num_remaining_operands);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_db_display_locals
- *
- * PARAMETERS: None
- *
- * RETURN: None
- *
- * DESCRIPTION: Display all locals for the currently running control method
- *
- ******************************************************************************/
-
-void
-acpi_db_display_locals (void)
-{
- u32 i;
- acpi_walk_state *walk_state;
- acpi_operand_object *obj_desc;
- acpi_namespace_node *node;
-
-
- walk_state = acpi_ds_get_current_walk_state (acpi_gbl_current_walk_list);
- if (!walk_state) {
- acpi_os_printf ("There is no method currently executing\n");
- return;
- }
-
- obj_desc = walk_state->method_desc;
- node = walk_state->method_node;
- acpi_os_printf ("Local Variables for method [%4.4s]:\n", node->name.ascii);
-
- for (i = 0; i < MTH_NUM_LOCALS; i++) {
- obj_desc = walk_state->local_variables[i].object;
- acpi_os_printf ("Local%d: ", i);
- acpi_db_display_internal_object (obj_desc, walk_state);
- }
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_db_display_arguments
- *
- * PARAMETERS: None
- *
- * RETURN: None
- *
- * DESCRIPTION: Display all arguments for the currently running control method
- *
- ******************************************************************************/
-
-void
-acpi_db_display_arguments (void)
-{
- u32 i;
- acpi_walk_state *walk_state;
- acpi_operand_object *obj_desc;
- u32 num_args;
- u32 concurrency;
- acpi_namespace_node *node;
-
-
- walk_state = acpi_ds_get_current_walk_state (acpi_gbl_current_walk_list);
- if (!walk_state) {
- acpi_os_printf ("There is no method currently executing\n");
- return;
- }
-
- obj_desc = walk_state->method_desc;
- node = walk_state->method_node;
-
- num_args = obj_desc->method.param_count;
- concurrency = obj_desc->method.concurrency;
-
- acpi_os_printf ("Method [%4.4s] has %X arguments, max concurrency = %X\n",
- node->name.ascii, num_args, concurrency);
-
- for (i = 0; i < num_args; i++) {
- obj_desc = walk_state->arguments[i].object;
- acpi_os_printf ("Arg%d: ", i);
- acpi_db_display_internal_object (obj_desc, walk_state);
- }
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_db_display_results
- *
- * PARAMETERS: None
- *
- * RETURN: None
- *
- * DESCRIPTION: Display current contents of a method result stack
- *
- ******************************************************************************/
-
-void
-acpi_db_display_results (void)
-{
- u32 i;
- acpi_walk_state *walk_state;
- acpi_operand_object *obj_desc;
- u32 num_results = 0;
- acpi_namespace_node *node;
-
-
- walk_state = acpi_ds_get_current_walk_state (acpi_gbl_current_walk_list);
- if (!walk_state) {
- acpi_os_printf ("There is no method currently executing\n");
- return;
- }
-
- obj_desc = walk_state->method_desc;
- node = walk_state->method_node;
-
- if (walk_state->results) {
- num_results = walk_state->results->results.num_results;
- }
-
- acpi_os_printf ("Method [%4.4s] has %X stacked result objects\n",
- node->name.ascii, num_results);
-
- for (i = 0; i < num_results; i++) {
- obj_desc = walk_state->results->results.obj_desc[i];
- acpi_os_printf ("Result%d: ", i);
- acpi_db_display_internal_object (obj_desc, walk_state);
- }
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_db_display_calling_tree
- *
- * PARAMETERS: None
- *
- * RETURN: None
- *
- * DESCRIPTION: Display current calling tree of nested control methods
- *
- ******************************************************************************/
-
-void
-acpi_db_display_calling_tree (void)
-{
- acpi_walk_state *walk_state;
- acpi_namespace_node *node;
-
-
- walk_state = acpi_ds_get_current_walk_state (acpi_gbl_current_walk_list);
- if (!walk_state) {
- acpi_os_printf ("There is no method currently executing\n");
- return;
- }
-
- node = walk_state->method_node;
- acpi_os_printf ("Current Control Method Call Tree\n");
-
- while (walk_state) {
- node = walk_state->method_node;
-
- acpi_os_printf (" [%4.4s]\n", node->name.ascii);
-
- walk_state = walk_state->next;
- }
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_db_display_result_object
- *
- * PARAMETERS: Obj_desc - Object to be displayed
- * Walk_state - Current walk state
- *
- * RETURN: None
- *
- * DESCRIPTION: Display the result of an AML opcode
- *
- * Note: Curently only displays the result object if we are single stepping.
- * However, this output may be useful in other contexts and could be enabled
- * to do so if needed.
- *
- ******************************************************************************/
-
-void
-acpi_db_display_result_object (
- acpi_operand_object *obj_desc,
- acpi_walk_state *walk_state)
-{
-
- /* Only display if single stepping */
-
- if (!acpi_gbl_cm_single_step) {
- return;
- }
-
- acpi_os_printf ("Result_obj: ");
- acpi_db_display_internal_object (obj_desc, walk_state);
- acpi_os_printf ("\n");
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_db_display_argument_object
- *
- * PARAMETERS: Obj_desc - Object to be displayed
- * Walk_state - Current walk state
- *
- * RETURN: None
- *
- * DESCRIPTION: Display the result of an AML opcode
- *
- ******************************************************************************/
-
-void
-acpi_db_display_argument_object (
- acpi_operand_object *obj_desc,
- acpi_walk_state *walk_state)
-{
-
- if (!acpi_gbl_cm_single_step) {
- return;
- }
-
- acpi_os_printf ("Arg_obj: ");
- acpi_db_display_internal_object (obj_desc, walk_state);
-}
-
-#endif /* ENABLE_DEBUGGER */
-
diff -Nru a/drivers/acpi/debugger/dbexec.c b/drivers/acpi/debugger/dbexec.c
--- a/drivers/acpi/debugger/dbexec.c Wed Oct 8 09:05:45 2003
+++ /dev/null Wed Dec 31 16:00:00 1969
@@ -1,398 +0,0 @@
-/*******************************************************************************
- *
- * Module Name: dbexec - debugger control method execution
- * $Revision: 41 $
- *
- ******************************************************************************/
-
-/*
- * Copyright (C) 2000 - 2002, R. Byron Moore
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-
-#include "acpi.h"
-#include "acdebug.h"
-
-#ifdef ENABLE_DEBUGGER
-
-#define _COMPONENT ACPI_DEBUGGER
- ACPI_MODULE_NAME ("dbexec")
-
-
-static acpi_db_method_info acpi_gbl_db_method_info;
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_db_execute_method
- *
- * PARAMETERS: Info - Valid info segment
- * Return_obj - Where to put return object
- *
- * RETURN: Status
- *
- * DESCRIPTION: Execute a control method.
- *
- ******************************************************************************/
-
-acpi_status
-acpi_db_execute_method (
- acpi_db_method_info *info,
- acpi_buffer *return_obj)
-{
- acpi_status status;
- acpi_object_list param_objects;
- acpi_object params[MTH_NUM_ARGS];
- u32 i;
-
-
- if (acpi_gbl_db_output_to_file && !acpi_dbg_level) {
- acpi_os_printf ("Warning: debug output is not enabled!\n");
- }
-
- /* Are there arguments to the method? */
-
- if (info->args && info->args[0]) {
- for (i = 0; info->args[i] && i < MTH_NUM_ARGS; i++) {
- params[i].type = ACPI_TYPE_INTEGER;
- params[i].integer.value = ACPI_STRTOUL (info->args[i], NULL, 16);
- }
-
- param_objects.pointer = params;
- param_objects.count = i;
- }
- else {
- /* Setup default parameters */
-
- params[0].type = ACPI_TYPE_INTEGER;
- params[0].integer.value = 0x01020304;
-
- params[1].type = ACPI_TYPE_STRING;
- params[1].string.length = 12;
- params[1].string.pointer = "AML Debugger";
-
- param_objects.pointer = params;
- param_objects.count = 2;
- }
-
- /* Prepare for a return object of arbitrary size */
-
- return_obj->pointer = acpi_gbl_db_buffer;
- return_obj->length = ACPI_DEBUG_BUFFER_SIZE;
-
- /* Do the actual method execution */
-
- status = acpi_evaluate_object (NULL, info->pathname, ¶m_objects, return_obj);
-
- acpi_gbl_cm_single_step = FALSE;
- acpi_gbl_method_executing = FALSE;
-
- return (status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_db_execute_setup
- *
- * PARAMETERS: Info - Valid method info
- *
- * RETURN: Status
- *
- * DESCRIPTION: Setup info segment prior to method execution
- *
- ******************************************************************************/
-
-void
-acpi_db_execute_setup (
- acpi_db_method_info *info)
-{
-
- /* Catenate the current scope to the supplied name */
-
- info->pathname[0] = 0;
- if ((info->name[0] != '\\') &&
- (info->name[0] != '/')) {
- ACPI_STRCAT (info->pathname, acpi_gbl_db_scope_buf);
- }
-
- ACPI_STRCAT (info->pathname, info->name);
- acpi_db_prep_namestring (info->pathname);
-
- acpi_db_set_output_destination (ACPI_DB_DUPLICATE_OUTPUT);
- acpi_os_printf ("Executing %s\n", info->pathname);
-
- if (info->flags & EX_SINGLE_STEP) {
- acpi_gbl_cm_single_step = TRUE;
- acpi_db_set_output_destination (ACPI_DB_CONSOLE_OUTPUT);
- }
-
- else {
- /* No single step, allow redirection to a file */
-
- acpi_db_set_output_destination (ACPI_DB_REDIRECTABLE_OUTPUT);
- }
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_db_get_outstanding_allocations
- *
- * PARAMETERS: None
- *
- * RETURN: Current global allocation count minus cache entries
- *
- * DESCRIPTION: Determine the current number of "outstanding" allocations --
- * those allocations that have not been freed and also are not
- * in one of the various object caches.
- *
- ******************************************************************************/
-
-u32
-acpi_db_get_outstanding_allocations (
- void)
-{
- u32 outstanding = 0;
-
-#ifdef ACPI_DBG_TRACK_ALLOCATIONS
- u32 i;
-
-
- for (i = ACPI_MEM_LIST_FIRST_CACHE_LIST; i < ACPI_NUM_MEM_LISTS; i++) {
- outstanding += (acpi_gbl_memory_lists[i].total_allocated -
- acpi_gbl_memory_lists[i].total_freed -
- acpi_gbl_memory_lists[i].cache_depth);
- }
-#endif
-
- return (outstanding);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_db_execute
- *
- * PARAMETERS: Name - Name of method to execute
- * Args - Parameters to the method
- * Flags - single step/no single step
- *
- * RETURN: Status
- *
- * DESCRIPTION: Execute a control method. Name is relative to the current
- * scope.
- *
- ******************************************************************************/
-
-void
-acpi_db_execute (
- NATIVE_CHAR *name,
- NATIVE_CHAR **args,
- u32 flags)
-{
- acpi_status status;
- acpi_buffer return_obj;
-
-
-#ifdef ACPI_DEBUG
- u32 previous_allocations;
- u32 allocations;
-
-
- /* Memory allocation tracking */
-
- previous_allocations = acpi_db_get_outstanding_allocations ();
-#endif
-
- acpi_gbl_db_method_info.name = name;
- acpi_gbl_db_method_info.args = args;
- acpi_gbl_db_method_info.flags = flags;
-
- acpi_db_execute_setup (&acpi_gbl_db_method_info);
- status = acpi_db_execute_method (&acpi_gbl_db_method_info, &return_obj);
-
- /*
- * Allow any handlers in separate threads to complete.
- * (Such as Notify handlers invoked from AML executed above).
- */
- acpi_os_sleep (0, 10);
-
-
-#ifdef ACPI_DEBUG
-
- /* Memory allocation tracking */
-
- allocations = acpi_db_get_outstanding_allocations () - previous_allocations;
-
- acpi_db_set_output_destination (ACPI_DB_DUPLICATE_OUTPUT);
-
- if (allocations > 0) {
- acpi_os_printf ("Outstanding: %ld allocations after execution\n",
- allocations);
- }
-#endif
-
- if (ACPI_FAILURE (status)) {
- acpi_os_printf ("Execution of %s failed with status %s\n",
- acpi_gbl_db_method_info.pathname, acpi_format_exception (status));
- }
-
- else {
- /* Display a return object, if any */
-
- if (return_obj.length) {
- acpi_os_printf ("Execution of %s returned object %p Buflen %X\n",
- acpi_gbl_db_method_info.pathname, return_obj.pointer, return_obj.length);
- acpi_db_dump_object (return_obj.pointer, 1);
- }
- }
-
- acpi_db_set_output_destination (ACPI_DB_CONSOLE_OUTPUT);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_db_method_thread
- *
- * PARAMETERS: Context - Execution info segment
- *
- * RETURN: None
- *
- * DESCRIPTION: Debugger execute thread. Waits for a command line, then
- * simply dispatches it.
- *
- ******************************************************************************/
-
-void ACPI_SYSTEM_XFACE
-acpi_db_method_thread (
- void *context)
-{
- acpi_status status;
- acpi_db_method_info *info = context;
- u32 i;
- acpi_buffer return_obj;
-
-
- for (i = 0; i < info->num_loops; i++) {
- status = acpi_db_execute_method (info, &return_obj);
- if (ACPI_SUCCESS (status)) {
- if (return_obj.length) {
- acpi_os_printf ("Execution of %s returned object %p Buflen %X\n",
- info->pathname, return_obj.pointer, return_obj.length);
- acpi_db_dump_object (return_obj.pointer, 1);
- }
- }
- }
-
- /* Signal our completion */
-
- status = acpi_os_signal_semaphore (info->thread_gate, 1);
- if (ACPI_FAILURE (status)) {
- acpi_os_printf ("Could not signal debugger semaphore\n");
- }
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_db_create_execution_threads
- *
- * PARAMETERS: Num_threads_arg - Number of threads to create
- * Num_loops_arg - Loop count for the thread(s)
- * Method_name_arg - Control method to execute
- *
- * RETURN: None
- *
- * DESCRIPTION: Create threads to execute method(s)
- *
- ******************************************************************************/
-
-void
-acpi_db_create_execution_threads (
- NATIVE_CHAR *num_threads_arg,
- NATIVE_CHAR *num_loops_arg,
- NATIVE_CHAR *method_name_arg)
-{
- acpi_status status;
- u32 num_threads;
- u32 num_loops;
- u32 i;
- acpi_handle thread_gate;
-
-
- /* Get the arguments */
-
- num_threads = ACPI_STRTOUL (num_threads_arg, NULL, 0);
- num_loops = ACPI_STRTOUL (num_loops_arg, NULL, 0);
-
- if (!num_threads || !num_loops) {
- acpi_os_printf ("Bad argument: Threads %X, Loops %X\n", num_threads, num_loops);
- return;
- }
-
- /* Create the synchronization semaphore */
-
- status = acpi_os_create_semaphore (1, 0, &thread_gate);
- if (ACPI_FAILURE (status)) {
- acpi_os_printf ("Could not create semaphore, %s\n", acpi_format_exception (status));
- return;
- }
-
- /* Setup the context to be passed to each thread */
-
- acpi_gbl_db_method_info.name = method_name_arg;
- acpi_gbl_db_method_info.args = NULL;
- acpi_gbl_db_method_info.flags = 0;
- acpi_gbl_db_method_info.num_loops = num_loops;
- acpi_gbl_db_method_info.thread_gate = thread_gate;
-
- acpi_db_execute_setup (&acpi_gbl_db_method_info);
-
- /* Create the threads */
-
- acpi_os_printf ("Creating %X threads to execute %X times each\n", num_threads, num_loops);
-
- for (i = 0; i < (num_threads); i++) {
- status = acpi_os_queue_for_execution (OSD_PRIORITY_MED, acpi_db_method_thread, &acpi_gbl_db_method_info);
- if (ACPI_FAILURE (status)) {
- break;
- }
- }
-
- /* Wait for all threads to complete */
-
- i = num_threads;
- while (i) /* Brain damage for OSD implementations that only support wait of 1 unit */ {
- status = acpi_os_wait_semaphore (thread_gate, 1, WAIT_FOREVER);
- i--;
- }
-
- /* Cleanup and exit */
-
- (void) acpi_os_delete_semaphore (thread_gate);
-
- acpi_db_set_output_destination (ACPI_DB_DUPLICATE_OUTPUT);
- acpi_os_printf ("All threads (%X) have completed\n", num_threads);
- acpi_db_set_output_destination (ACPI_DB_CONSOLE_OUTPUT);
-}
-
-
-#endif /* ENABLE_DEBUGGER */
-
-
diff -Nru a/drivers/acpi/debugger/dbfileio.c b/drivers/acpi/debugger/dbfileio.c
--- a/drivers/acpi/debugger/dbfileio.c Wed Oct 8 09:05:45 2003
+++ /dev/null Wed Dec 31 16:00:00 1969
@@ -1,393 +0,0 @@
-/*******************************************************************************
- *
- * Module Name: dbfileio - Debugger file I/O commands. These can't usually
- * be used when running the debugger in Ring 0 (Kernel mode)
- * $Revision: 63 $
- *
- ******************************************************************************/
-
-/*
- * Copyright (C) 2000 - 2002, R. Byron Moore
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-
-#include "acpi.h"
-#include "acdebug.h"
-#include "acnamesp.h"
-#include "actables.h"
-
-#ifdef ENABLE_DEBUGGER
-
-#define _COMPONENT ACPI_DEBUGGER
- ACPI_MODULE_NAME ("dbfileio")
-
-
-/*
- * NOTE: this is here for lack of a better place. It is used in all
- * flavors of the debugger, need LCD file
- */
-#ifdef ACPI_APPLICATION
-#include
-FILE *acpi_gbl_debug_file = NULL;
-#endif
-
-
-acpi_table_header *acpi_gbl_db_table_ptr = NULL;
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_db_match_argument
- *
- * PARAMETERS: User_argument - User command line
- * Arguments - Array of commands to match against
- *
- * RETURN: Index into command array or ACPI_TYPE_NOT_FOUND if not found
- *
- * DESCRIPTION: Search command array for a command match
- *
- ******************************************************************************/
-
-acpi_object_type
-acpi_db_match_argument (
- NATIVE_CHAR *user_argument,
- ARGUMENT_INFO *arguments)
-{
- u32 i;
-
-
- if (!user_argument || user_argument[0] == 0) {
- return (ACPI_TYPE_NOT_FOUND);
- }
-
- for (i = 0; arguments[i].name; i++) {
- if (ACPI_STRSTR (arguments[i].name, user_argument) == arguments[i].name) {
- return (i);
- }
- }
-
- /* Argument not recognized */
-
- return (ACPI_TYPE_NOT_FOUND);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_db_close_debug_file
- *
- * PARAMETERS: None
- *
- * RETURN: Status
- *
- * DESCRIPTION: If open, close the current debug output file
- *
- ******************************************************************************/
-
-void
-acpi_db_close_debug_file (
- void)
-{
-
-#ifdef ACPI_APPLICATION
-
- if (acpi_gbl_debug_file) {
- fclose (acpi_gbl_debug_file);
- acpi_gbl_debug_file = NULL;
- acpi_gbl_db_output_to_file = FALSE;
- acpi_os_printf ("Debug output file %s closed\n", acpi_gbl_db_debug_filename);
- }
-#endif
-
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_db_open_debug_file
- *
- * PARAMETERS: Name - Filename to open
- *
- * RETURN: Status
- *
- * DESCRIPTION: Open a file where debug output will be directed.
- *
- ******************************************************************************/
-
-void
-acpi_db_open_debug_file (
- NATIVE_CHAR *name)
-{
-
-#ifdef ACPI_APPLICATION
-
- acpi_db_close_debug_file ();
- acpi_gbl_debug_file = fopen (name, "w+");
- if (acpi_gbl_debug_file) {
- acpi_os_printf ("Debug output file %s opened\n", name);
- ACPI_STRCPY (acpi_gbl_db_debug_filename, name);
- acpi_gbl_db_output_to_file = TRUE;
- }
- else {
- acpi_os_printf ("Could not open debug file %s\n", name);
- }
-
-#endif
-}
-
-
-#ifdef ACPI_APPLICATION
-/*******************************************************************************
- *
- * FUNCTION: Acpi_db_load_table
- *
- * PARAMETERS: fp - File that contains table
- * Table_ptr - Return value, buffer with table
- * Table_lenght - Return value, length of table
- *
- * RETURN: Status
- *
- * DESCRIPTION: Load the DSDT from the file pointer
- *
- ******************************************************************************/
-
-static acpi_status
-acpi_db_load_table(
- FILE *fp,
- acpi_table_header **table_ptr,
- u32 *table_length)
-{
- acpi_table_header table_header;
- u8 *aml_start;
- u32 aml_length;
- u32 actual;
- acpi_status status;
-
-
- /* Read the table header */
-
- if (fread (&table_header, 1, sizeof (table_header), fp) != sizeof (acpi_table_header)) {
- acpi_os_printf ("Couldn't read the table header\n");
- return (AE_BAD_SIGNATURE);
- }
-
-
- /* Validate the table header/length */
-
- status = acpi_tb_validate_table_header (&table_header);
- if ((ACPI_FAILURE (status)) ||
- (table_header.length > 524288)) /* 1/2 Mbyte should be enough */ {
- acpi_os_printf ("Table header is invalid!\n");
- return (AE_ERROR);
- }
-
-
- /* We only support a limited number of table types */
-
- if (ACPI_STRNCMP ((char *) table_header.signature, DSDT_SIG, 4) &&
- ACPI_STRNCMP ((char *) table_header.signature, PSDT_SIG, 4) &&
- ACPI_STRNCMP ((char *) table_header.signature, SSDT_SIG, 4)) {
- acpi_os_printf ("Table signature is invalid\n");
- ACPI_DUMP_BUFFER (&table_header, sizeof (acpi_table_header));
- return (AE_ERROR);
- }
-
- /* Allocate a buffer for the table */
-
- *table_length = table_header.length;
- *table_ptr = acpi_os_allocate ((size_t) *table_length);
- if (!*table_ptr) {
- acpi_os_printf ("Could not allocate memory for ACPI table %4.4s (size=%X)\n",
- table_header.signature, table_header.length);
- return (AE_NO_MEMORY);
- }
-
-
- aml_start = (u8 *) *table_ptr + sizeof (table_header);
- aml_length = *table_length - sizeof (table_header);
-
- /* Copy the header to the buffer */
-
- ACPI_MEMCPY (*table_ptr, &table_header, sizeof (table_header));
-
- /* Get the rest of the table */
-
- actual = fread (aml_start, 1, (size_t) aml_length, fp);
- if (actual == aml_length) {
- return (AE_OK);
- }
-
- if (actual > 0) {
- acpi_os_printf ("Warning - reading table, asked for %X got %X\n", aml_length, actual);
- return (AE_OK);
- }
-
-
- acpi_os_printf ("Error - could not read the table file\n");
- acpi_os_free (*table_ptr);
- *table_ptr = NULL;
- *table_length = 0;
-
- return (AE_ERROR);
-}
-#endif
-
-
-/*******************************************************************************
- *
- * FUNCTION: Ae_local_load_table
- *
- * PARAMETERS: Table_ptr - pointer to a buffer containing the entire
- * table to be loaded
- *
- * RETURN: Status
- *
- * DESCRIPTION: This function is called to load a table from the caller's
- * buffer. The buffer must contain an entire ACPI Table including
- * a valid header. The header fields will be verified, and if it
- * is determined that the table is invalid, the call will fail.
- *
- * If the call fails an appropriate status will be returned.
- *
- ******************************************************************************/
-
-acpi_status
-ae_local_load_table (
- acpi_table_header *table_ptr)
-{
- acpi_status status;
- acpi_table_desc table_info;
-
-
- ACPI_FUNCTION_TRACE ("Ae_local_load_table");
-
- if (!table_ptr) {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
-
- /* Install the new table into the local data structures */
-
- table_info.pointer = table_ptr;
-
- status = acpi_tb_install_table (&table_info);
- if (ACPI_FAILURE (status)) {
- /* Free table allocated by Acpi_tb_get_table */
-
- acpi_tb_delete_single_table (&table_info);
- return_ACPI_STATUS (status);
- }
-
-
-#ifndef PARSER_ONLY
- status = acpi_ns_load_table (table_info.installed_desc, acpi_gbl_root_node);
- if (ACPI_FAILURE (status)) {
- /* Uninstall table and free the buffer */
-
- acpi_tb_delete_acpi_table (ACPI_TABLE_DSDT);
- return_ACPI_STATUS (status);
- }
-#endif
-
- return_ACPI_STATUS (status);
-}
-
-
-#ifdef ACPI_APPLICATION
-acpi_status
-acpi_db_get_acpi_table (
- NATIVE_CHAR *filename)
-{
- FILE *fp;
- u32 table_length;
- acpi_status status;
-
- /* Open the file */
-
- fp = fopen (filename, "rb");
- if (!fp) {
- acpi_os_printf ("Could not open file %s\n", filename);
- return (AE_ERROR);
- }
-
-
- /* Get the entire file */
-
- acpi_os_printf ("Loading Acpi table from file %s\n", filename);
- status = acpi_db_load_table (fp, &acpi_gbl_db_table_ptr, &table_length);
- fclose(fp);
-
- if (ACPI_FAILURE (status)) {
- acpi_os_printf ("Couldn't get table from the file\n");
- return (status);
- }
-
- return (AE_OK);
- }
-#endif
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_db_load_acpi_table
- *
- * PARAMETERS: Filname - File where table is located
- *
- * RETURN: Status
- *
- * DESCRIPTION: Load an ACPI table from a file
- *
- ******************************************************************************/
-
-acpi_status
-acpi_db_load_acpi_table (
- NATIVE_CHAR *filename) {
-#ifdef ACPI_APPLICATION
- acpi_status status;
-
-
- status = acpi_db_get_acpi_table (filename);
- if (ACPI_FAILURE (status)) {
- return (status);
- }
-
- /* Attempt to recognize and install the table */
-
- status = ae_local_load_table (acpi_gbl_db_table_ptr);
- if (ACPI_FAILURE (status)) {
- if (status == AE_ALREADY_EXISTS) {
- acpi_os_printf ("Table %4.4s is already installed\n",
- acpi_gbl_db_table_ptr->signature);
- }
- else {
- acpi_os_printf ("Could not install table, %s\n",
- acpi_format_exception (status));
- }
-
- return (status);
- }
-
- acpi_os_printf ("%4.4s at %p successfully installed and loaded\n",
- acpi_gbl_db_table_ptr->signature, acpi_gbl_db_table_ptr);
-
- acpi_gbl_acpi_hardware_present = FALSE;
-
-#endif /* ACPI_APPLICATION */
- return (AE_OK);
-}
-
-
-#endif /* ENABLE_DEBUGGER */
-
diff -Nru a/drivers/acpi/debugger/dbhistry.c b/drivers/acpi/debugger/dbhistry.c
--- a/drivers/acpi/debugger/dbhistry.c Wed Oct 8 09:05:45 2003
+++ /dev/null Wed Dec 31 16:00:00 1969
@@ -1,189 +0,0 @@
-/******************************************************************************
- *
- * Module Name: dbhistry - debugger HISTORY command
- * $Revision: 24 $
- *
- *****************************************************************************/
-
-/*
- * Copyright (C) 2000 - 2002, R. Byron Moore
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-
-#include "acpi.h"
-#include "acdebug.h"
-
-#ifdef ENABLE_DEBUGGER
-
-#define _COMPONENT ACPI_DEBUGGER
- ACPI_MODULE_NAME ("dbhistry")
-
-
-#define HI_NO_HISTORY 0
-#define HI_RECORD_HISTORY 1
-#define HISTORY_SIZE 20
-
-
-typedef struct history_info
-{
- NATIVE_CHAR command[80];
- u32 cmd_num;
-
-} HISTORY_INFO;
-
-
-static HISTORY_INFO acpi_gbl_history_buffer[HISTORY_SIZE];
-static u16 acpi_gbl_lo_history = 0;
-static u16 acpi_gbl_num_history = 0;
-static u16 acpi_gbl_next_history_index = 0;
-static u32 acpi_gbl_next_cmd_num = 1;
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_db_add_to_history
- *
- * PARAMETERS: Command_line - Command to add
- *
- * RETURN: None
- *
- * DESCRIPTION: Add a command line to the history buffer.
- *
- ******************************************************************************/
-
-void
-acpi_db_add_to_history (
- NATIVE_CHAR *command_line)
-{
-
- /* Put command into the next available slot */
-
- ACPI_STRCPY (acpi_gbl_history_buffer[acpi_gbl_next_history_index].command, command_line);
-
- acpi_gbl_history_buffer[acpi_gbl_next_history_index].cmd_num = acpi_gbl_next_cmd_num;
-
- /* Adjust indexes */
-
- if ((acpi_gbl_num_history == HISTORY_SIZE) &&
- (acpi_gbl_next_history_index == acpi_gbl_lo_history)) {
- acpi_gbl_lo_history++;
- if (acpi_gbl_lo_history >= HISTORY_SIZE) {
- acpi_gbl_lo_history = 0;
- }
- }
-
- acpi_gbl_next_history_index++;
- if (acpi_gbl_next_history_index >= HISTORY_SIZE) {
- acpi_gbl_next_history_index = 0;
- }
-
- acpi_gbl_next_cmd_num++;
- if (acpi_gbl_num_history < HISTORY_SIZE) {
- acpi_gbl_num_history++;
- }
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_db_display_history
- *
- * PARAMETERS: None
- *
- * RETURN: None
- *
- * DESCRIPTION: Display the contents of the history buffer
- *
- ******************************************************************************/
-
-void
-acpi_db_display_history (void)
-{
- NATIVE_UINT i;
- u16 history_index;
-
-
- history_index = acpi_gbl_lo_history;
-
- /* Dump entire history buffer */
-
- for (i = 0; i < acpi_gbl_num_history; i++) {
- acpi_os_printf ("%ld %s\n", acpi_gbl_history_buffer[history_index].cmd_num,
- acpi_gbl_history_buffer[history_index].command);
-
- history_index++;
- if (history_index >= HISTORY_SIZE) {
- history_index = 0;
- }
- }
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_db_get_from_history
- *
- * PARAMETERS: Command_num_arg - String containing the number of the
- * command to be retrieved
- *
- * RETURN: None
- *
- * DESCRIPTION: Get a command from the history buffer
- *
- ******************************************************************************/
-
-NATIVE_CHAR *
-acpi_db_get_from_history (
- NATIVE_CHAR *command_num_arg)
-{
- NATIVE_UINT i;
- u16 history_index;
- u32 cmd_num;
-
-
- if (command_num_arg == NULL) {
- cmd_num = acpi_gbl_next_cmd_num - 1;
- }
-
- else {
- cmd_num = ACPI_STRTOUL (command_num_arg, NULL, 0);
- }
-
- /* Search history buffer */
-
- history_index = acpi_gbl_lo_history;
- for (i = 0; i < acpi_gbl_num_history; i++) {
- if (acpi_gbl_history_buffer[history_index].cmd_num == cmd_num) {
- /* Found the commnad, return it */
-
- return (acpi_gbl_history_buffer[history_index].command);
- }
-
-
- history_index++;
- if (history_index >= HISTORY_SIZE) {
- history_index = 0;
- }
- }
-
- acpi_os_printf ("Invalid history number: %d\n", history_index);
- return (NULL);
-}
-
-
-#endif /* ENABLE_DEBUGGER */
-
diff -Nru a/drivers/acpi/debugger/dbinput.c b/drivers/acpi/debugger/dbinput.c
--- a/drivers/acpi/debugger/dbinput.c Wed Oct 8 09:05:46 2003
+++ /dev/null Wed Dec 31 16:00:00 1969
@@ -1,892 +0,0 @@
-/*******************************************************************************
- *
- * Module Name: dbinput - user front-end to the AML debugger
- * $Revision: 86 $
- *
- ******************************************************************************/
-
-/*
- * Copyright (C) 2000 - 2002, R. Byron Moore
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-
-#include "acpi.h"
-#include "acdebug.h"
-
-
-#ifdef ENABLE_DEBUGGER
-
-#define _COMPONENT ACPI_DEBUGGER
- ACPI_MODULE_NAME ("dbinput")
-
-
-/*
- * Top-level debugger commands.
- *
- * This list of commands must match the string table below it
- */
-enum acpi_ex_debugger_commands
-{
- CMD_NOT_FOUND = 0,
- CMD_NULL,
- CMD_ALLOCATIONS,
- CMD_ARGS,
- CMD_ARGUMENTS,
- CMD_BREAKPOINT,
- CMD_CALL,
- CMD_CLOSE,
- CMD_DEBUG,
- CMD_DUMP,
- CMD_ENABLEACPI,
- CMD_EVENT,
- CMD_EXECUTE,
- CMD_EXIT,
- CMD_FIND,
- CMD_GO,
- CMD_HELP,
- CMD_HELP2,
- CMD_HISTORY,
- CMD_HISTORY_EXE,
- CMD_HISTORY_LAST,
- CMD_INFORMATION,
- CMD_INTEGRITY,
- CMD_INTO,
- CMD_LEVEL,
- CMD_LIST,
- CMD_LOAD,
- CMD_LOCALS,
- CMD_LOCKS,
- CMD_METHODS,
- CMD_NAMESPACE,
- CMD_NOTIFY,
- CMD_OBJECT,
- CMD_OPEN,
- CMD_OWNER,
- CMD_PREFIX,
- CMD_QUIT,
- CMD_REFERENCES,
- CMD_RESOURCES,
- CMD_RESULTS,
- CMD_SET,
- CMD_STATS,
- CMD_STOP,
- CMD_TABLES,
- CMD_TERMINATE,
- CMD_THREADS,
- CMD_TREE,
- CMD_UNLOAD
-};
-
-#define CMD_FIRST_VALID 2
-
-
-static const COMMAND_INFO acpi_gbl_db_commands[] =
-{ {"", 0},
- {"", 0},
- {"ALLOCATIONS", 0},
- {"ARGS", 0},
- {"ARGUMENTS", 0},
- {"BREAKPOINT", 1},
- {"CALL", 0},
- {"CLOSE", 0},
- {"DEBUG", 1},
- {"DUMP", 1},
- {"ENABLEACPI", 0},
- {"EVENT", 1},
- {"EXECUTE", 1},
- {"EXIT", 0},
- {"FIND", 1},
- {"GO", 0},
- {"HELP", 0},
- {"?", 0},
- {"HISTORY", 0},
- {"!", 1},
- {"!!", 0},
- {"INFORMATION", 0},
- {"INTEGRITY", 0},
- {"INTO", 0},
- {"LEVEL", 0},
- {"LIST", 0},
- {"LOAD", 1},
- {"LOCALS", 0},
- {"LOCKS", 0},
- {"METHODS", 0},
- {"NAMESPACE", 0},
- {"NOTIFY", 2},
- {"OBJECT", 1},
- {"OPEN", 1},
- {"OWNER", 1},
- {"PREFIX", 0},
- {"QUIT", 0},
- {"REFERENCES", 1},
- {"RESOURCES", 1},
- {"RESULTS", 0},
- {"SET", 3},
- {"STATS", 0},
- {"STOP", 0},
- {"TABLES", 0},
- {"TERMINATE", 0},
- {"THREADS", 3},
- {"TREE", 0},
- {"UNLOAD", 1},
- {NULL, 0}
-};
-
-
-/*******************************************************************************
- *
- * FUNCTION: Acpi_db_display_help
- *
- * PARAMETERS: Help_type - Subcommand (optional)
- *
- * RETURN: None
- *
- * DESCRIPTION: Print a usage message.
- *
- ******************************************************************************/
-
-void
-acpi_db_display_help (
- NATIVE_CHAR *help_type)
-{
-
-
- /* No parameter, just give the overview */
-
- if (!help_type)
- {
- acpi_os_printf ("ACPI CA Debugger Commands\n\n");
- acpi_os_printf ("The following classes of commands are available. Help is available for\n");
- acpi_os_printf ("each class by entering \"Help \"\n\n");
- acpi_os_printf (" [GENERAL] General-Purpose Commands\n");
- acpi_os_printf (" [NAMESPACE] Namespace Access Commands\n");
- acpi_os_printf (" [METHOD] Control Method Execution Commands\n");
- acpi_os_printf (" [FILE] File I/O Commands\n");
- return;
-
- }
-
- /*
- * Parameter is the command class
- *
- * The idea here is to keep each class of commands smaller than a screenful
- */
- switch (help_type[0])
- {
- case 'G':
- acpi_os_printf ("\n_general-Purpose Commands\n\n");
- acpi_os_printf ("Allocations Display list of current memory allocations\n");
- acpi_os_printf ("Dump |\n");
- acpi_os_printf (" [Byte|Word|Dword|Qword] Display ACPI objects or memory\n");
- acpi_os_printf ("Enable_acpi Enable ACPI (hardware) mode\n");
- acpi_os_printf ("Help This help screen\n");
- acpi_os_printf ("History Display command history buffer\n");
- acpi_os_printf ("Level [] [console] Get/Set debug level for file or console\n");
- acpi_os_printf ("Locks Current status of internal mutexes\n");
- acpi_os_printf ("Quit or Exit Exit this command\n");
- acpi_os_printf ("Stats [Allocations|Memory|Misc\n");
- acpi_os_printf (" |Objects|Tables] Display namespace and memory statistics\n");
- acpi_os_printf ("Tables Display info about loaded ACPI tables\n");
- acpi_os_printf ("Unload [Instance] Unload an ACPI table\n");
- acpi_os_printf ("! Execute command from history buffer\n");
- acpi_os_printf ("!! Execute last command again\n");
- return;
-
- case 'N':
- acpi_os_printf ("\n_namespace Access Commands\n\n");
- acpi_os_printf ("Debug [Arguments] Single Step a control method\n");
- acpi_os_printf ("Event Generate Acpi_event (Fixed/GPE)\n");
- acpi_os_printf ("Execute [Arguments] Execute control method\n");
- acpi_os_printf ("Find (? is wildcard) Find ACPI name(s) with wildcards\n");
- acpi_os_printf ("Method Display list of loaded control methods\n");
- acpi_os_printf ("Namespace [|] [Depth] Display loaded namespace tree/subtree\n");
- acpi_os_printf ("Notify Send a notification\n");
- acpi_os_printf ("Objects Display all objects of the given type\n");
- acpi_os_printf ("Owner [Depth] Display loaded namespace by object owner\n");
- acpi_os_printf ("Prefix [] Set or Get current execution prefix\n");
- acpi_os_printf ("References Find all references to object at addr\n");
- acpi_os_printf ("Resources xxx Get and display resources\n");
- acpi_os_printf ("Terminate Delete namespace and all internal objects\n");
- acpi_os_printf ("Thread Spawn threads to execute method(s)\n");
- return;
-
- case 'M':
- acpi_os_printf ("\n_control Method Execution Commands\n\n");
- acpi_os_printf ("Arguments (or Args) Display method arguments\n");
- acpi_os_printf ("Breakpoint Set an AML execution breakpoint\n");
- acpi_os_printf ("Call Run to next control method invocation\n");
- acpi_os_printf ("Go Allow method to run to completion\n");
- acpi_os_printf ("Information Display info about the current method\n");
- acpi_os_printf ("Into Step into (not over) a method call\n");
- acpi_os_printf ("List [# of Aml Opcodes] Display method ASL statements\n");
- acpi_os_printf ("Locals Display method local variables\n");
- acpi_os_printf ("Results Display method result stack\n");
- acpi_os_printf ("Set <#> Set method data (Arguments/Locals)\n");
- acpi_os_printf ("Stop Terminate control method\n");
- acpi_os_printf ("Tree Display control method calling tree\n");
- acpi_os_printf (" Single step next AML opcode (over calls)\n");
- return;
-
- case 'F':
- acpi_os_printf ("\n_file I/O Commands\n\n");
- acpi_os_printf ("Close Close debug output file\n");
- acpi_os_printf ("Open